Chapter1 ¶
1.
- 고객 .
- 객 . ( )
- OCP . ( )
1) 고객 기 .
2) 객 기 게 .
3) .
기 50% 2) 객 기 게 .
3) .
import java.io.*; class Guitar { private GuitarProperty GP; Guitar() { this.GP = null; } Guitar(GuitarProperty GP) { this.GP = GP; } public void setGP(GuitarProperty nGP){ this.GP = nGP; } public GuitarPeroperty getGP() { return this.GP; } } class GuitarProperty { private String serialNumber; private double price; private String builder; private String model; private String type; private String backWood; private String topWood; public String getserialNumber(){ } GuitarProperty() { this.serialNumber = null; this.price = 0; this.builder = null; this.model = null; this.type = null; this.backWood = null; this.topWood = null; } GuitarProperty(String SN, double price, String builder, String model, String type, String backWood, String topWood) { this.serialNumber = SN; this.price = price; this.builder = builder; this.model = model; this.type = type; this.backWood = backWood; this.topWood = topWood; } public String getserialNumber() {return this.serialNumber; } public double getPrice() { return this.price; } public void setPrice(double newprice) { this.price = newprice; } public String getBuilder() { return this.builder; } public String getModel() { return this.model; } public String getType() { return this.type; } public String getBackWood() { return this.backWood; } public String getTopWood() { return this.topWood; } } class GuitarList { public Guitar Guitar; public GuitarList next; GuitarList() { this.Guitar = null; this.next = null; } class Inventory{ private GuitarList GuitarList; private GuitarList GLPointer; public void addGuitar(GuitarProperty newGuitar) { this.GLPointer = this.GuitarList; while (this.GLPointer.next != null) { this.GLPointer = this.GLPointer.next; } this.GLPointer.next = new GuitarList(); this.GLPointer.next.Guitar = new Guitar(newGuitar); } public Guitar getGuitar(String sn){ this.GLPointer = this.GuitarList; while(this.GLPointer.Guitar != null && this.GLPointer.Guitar.getGP().getserialNumber() != sn && this.GLPointer.next != null) { this.GLPointer = this.GLPointer.next; } if (this.GLPointer.next == null && this.GLPointer.Guitar.getGP().getserialNumber() != sn) { return null; } else { return this.GLPointer.Guitar; } } public Guitar Search(GuitarProperty SGP) { } }Main 기