-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathCDType.java
More file actions
29 lines (29 loc) · 1.15 KB
/
CDType.java
File metadata and controls
29 lines (29 loc) · 1.15 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import java.util.ArrayList;
import java.util.List;
public class CDType {
private List<Packing> items=new ArrayList<Packing>();
public void addItem(Packing packs) {
items.add(packs);
}
//Memanggil method price() dari setiap objek Packing
public void getCost(){
for (Packing packs : items) {
packs.price();
}
}
//Memanggil method year() dari setiap objek Packing
public void getYear(){
for (Packing packs : items) {
packs.year();
}
}
//Menampilkan informasi terkait setiap item ke layar
public void showItems(){
for (Packing packing : items){
System.out.print(packing.pack());
System.out.print("| Tahun : "+packing.year());
System.out.print("| Type : "+packing.transmisi());
System.out.println("| Harga : "+packing.price());
}
}
}//End of the CDType class.