Toggle menu
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.

김동준/Project/OOP Preview/Chapter1: Difference between revisions

From ZeroWiki
imported>teledong
No edit summary
(Repair batch-0004 pages from live compare)
 
Line 2: Line 2:


1.위대한 소프트웨어의 제작 방법
1.위대한 소프트웨어의 제작 방법
  * 고객이 바라는 것을 제대로 수행하는 소프트웨어.
** 고객이 바라는 것을 제대로 수행하는 소프트웨어.
  * 객체지향으로 만들어진 코드들. (코드의 유연성)
** 객체지향으로 만들어진 코드들. (코드의 유연성)
  * OCP의 원리 이용. (코드의 재사용성)
** OCP의 원리 이용. (코드의 재사용성)
2. 만들기 방법
# 만들기 방법
   1) 소프트웨어가 고객이 원하는 기능을 하도록 한다.
   1) 소프트웨어가 고객이 원하는 기능을 하도록 한다.
   2) 객체지향의 기본 원리를 적용해서 소프트웨어를 유연하게 한다.
   2) 객체지향의 기본 원리를 적용해서 소프트웨어를 유연하게 한다.
Line 11: Line 11:


릭의 기타 관리 시스템 50% 완성
릭의 기타 관리 시스템 50% 완성
{{{
import java.io.*;
import java.io.*;
 
class Guitar {
class Guitar {
private GuitarProperty GP;
private GuitarProperty GP;
Guitar() {
Guitar() {
this.GP = null;
this.GP = null;
}
}
Guitar(GuitarProperty GP) {
Guitar(GuitarProperty GP) {
this.GP = GP;
this.GP = GP;
}
}
public void setGP(GuitarProperty nGP){
public void setGP(GuitarProperty nGP){
this.GP = nGP;
this.GP = nGP;
}
}
public GuitarPeroperty getGP() {
public GuitarPeroperty getGP() {
return this.GP;
return this.GP;
}
}
}
}
class GuitarProperty {
class GuitarProperty {
private String serialNumber;
private String serialNumber;
private double price;
private double price;
private String builder;
private String builder;
private String model;
private String model;
private String type;
private String type;
private String backWood;
private String backWood;
private String topWood;
private String topWood;
public String getserialNumber(){
public String getserialNumber(){
}
}
GuitarProperty() {
GuitarProperty() {
this.serialNumber = null;
this.serialNumber = null;
this.price = 0;
this.price = 0;
this.builder = null;
this.builder = null;
this.model = null;
this.model = null;
this.type = null;
this.type = null;
this.backWood = null;
this.backWood = null;
this.topWood = null;
this.topWood = null;
}
}
GuitarProperty(String SN, double price, String builder, String model, String type,  
GuitarProperty(String SN, double price, String builder, String model, String type,  
String backWood, String topWood) {
String backWood, String topWood) {
this.serialNumber = SN;
this.serialNumber = SN;
this.price = price;
this.price = price;
this.builder = builder;
this.builder = builder;
this.model = model;
this.model = model;
this.type = type;
this.type = type;
this.backWood = backWood;
this.backWood = backWood;
this.topWood = topWood;
this.topWood = topWood;
}
}
public String getserialNumber() {return this.serialNumber; }
public String getserialNumber() {return this.serialNumber; }
public double getPrice() { return this.price; }
public double getPrice() { return this.price; }
public void setPrice(double newprice) { this.price = newprice; }
public void setPrice(double newprice) { this.price = newprice; }
public String getBuilder() { return this.builder; }
public String getBuilder() { return this.builder; }
public String getModel() { return this.model; }
public String getModel() { return this.model; }
public String getType() { return this.type; }
public String getType() { return this.type; }
public String getBackWood() { return this.backWood; }
public String getBackWood() { return this.backWood; }
public String getTopWood() { return this.topWood; }
public String getTopWood() { return this.topWood; }
}
}
class GuitarList {
class GuitarList {
public Guitar Guitar;
public Guitar Guitar;
public GuitarList next;
public GuitarList next;
GuitarList() {
GuitarList() {
this.Guitar = null;
this.Guitar = null;
this.next = null;
this.next = null;
}
}
class Inventory{
class Inventory{
private GuitarList GuitarList;
private GuitarList GuitarList;
private GuitarList GLPointer;
private GuitarList GLPointer;
public void addGuitar(GuitarProperty newGuitar) {
public void addGuitar(GuitarProperty newGuitar) {
this.GLPointer = this.GuitarList;
this.GLPointer = this.GuitarList;
while (this.GLPointer.next != null) {
while (this.GLPointer.next != null) {
this.GLPointer = this.GLPointer.next;
this.GLPointer = this.GLPointer.next;
}
}
this.GLPointer.next = new GuitarList();
this.GLPointer.next = new GuitarList();
this.GLPointer.next.Guitar = new Guitar(newGuitar);
this.GLPointer.next.Guitar = new Guitar(newGuitar);
}
}
public Guitar getGuitar(String sn){
public Guitar getGuitar(String sn){
this.GLPointer = this.GuitarList;
this.GLPointer = this.GuitarList;
while(this.GLPointer.Guitar != null && this.GLPointer.Guitar.getGP().getserialNumber() != sn && this.GLPointer.next != null) {
while(this.GLPointer.Guitar != null && this.GLPointer.Guitar.getGP().getserialNumber() != sn && this.GLPointer.next != null) {
this.GLPointer = this.GLPointer.next;
this.GLPointer = this.GLPointer.next;
}
}
if (this.GLPointer.next == null && this.GLPointer.Guitar.getGP().getserialNumber() != sn) {
if (this.GLPointer.next == null && this.GLPointer.Guitar.getGP().getserialNumber() != sn) {
return null;
return null;
}
}
else {
else {
return this.GLPointer.Guitar;
return this.GLPointer.Guitar;
}
}
}
}
public Guitar Search(GuitarProperty SGP) {
public Guitar Search(GuitarProperty SGP) {
}
}
}
}
}}}
[http://inyourheart.biz/zerowiki/wiki.php/%EA%B9%80%EB%8F%99%EC%A4%80/Project/OOP_Preview Main으로 가기]
[http://inyourheart.biz/zerowiki/wiki.php/%EA%B9%80%EB%8F%99%EC%A4%80/Project/OOP_Preview Main으로 가기]

Latest revision as of 00:37, 27 March 2026

Chapter1 진행내용

1.위대한 소프트웨어의 제작 방법

    • 고객이 바라는 것을 제대로 수행하는 소프트웨어.
    • 객체지향으로 만들어진 코드들. (코드의 유연성)
    • OCP의 원리 이용. (코드의 재사용성)
  1. 만들기 방법
 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으로 가기