-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathMarketDriver.java
More file actions
21 lines (20 loc) · 971 Bytes
/
MarketDriver.java
File metadata and controls
21 lines (20 loc) · 971 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
public class MarketDriver {
public static void main(String[] args) {
MarketGood g1 = new MarketGood("MacBook Air", 1250000);
MarketGood g2 = new MarketGood("MacBook Pro", 2990000, 15);
MarketGood g3 = new MarketGood("iPhone 7", 920000, 20);
System.out.println(g1.name + "의 할인율: "
+ g1.getDiscountRate() + "%");
System.out.println(g2.name + "의 할인율: "
+ g2.getDiscountRate() + "%");
System.out.println(g3.name + "의 정상 가격: "
+ g3.retailPrice + "원");
System.out.println(g3.name + "의 할인 가격: "
+ g3.getDiscountedPrice() + "원");
System.out.println("경쟁 업체가 많아져서 " + g3.name
+ "의 할인율이 35%로 올랐습니다.");
g3.setDiscountRate(35);
System.out.println(g3.name + "의 할인 가격: "
+ g3.getDiscountedPrice() + "원");
}
}