U E D R , A S I H C RSS

김동준/Project/OOP_Preview/Chapter1

Chapter1 진행내용


1.위대한 소프트웨어의 제작 방법
  • 고객이 바라는 것을 제대로 수행하는 소프트웨어.
  • 객체지향으로 만들어진 코드들. (코드의 유연성)
  • OCP의 원리 이용. (코드의 재사용성)
2. 만들기 방법
1) 소프트웨어가 고객이 원하는 기능을 하도록 한다.
2) 객체지향의 기본 원리를 적용해서 소프트웨어를 유연하게 한다.
3) 유지보수와 재사용이 쉬운 디자인을 위해 노력한다.

릭의 기타 관리 시스템 50% 완성
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으로 가기
Valid XHTML 1.0! Valid CSS! powered by MoniWiki
last modified 2021-02-07 05:28:48
Processing time 0.0130 sec