-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathDriver.java
50 lines (43 loc) · 1.9 KB
/
Driver.java
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package challenge;
/**
*
* @author RIVAN DWI ARHIANSYAH(18102068)
*/
public class Driver {
public static void main(String[] args) {
//pembentukan objek mobil YANG BERPARAMETER
Mobil m1 = new Mobil("Toyota", "B14589", 2015);
Mobil m2 = new Mobil("Suzuki", "R10025", 2018);
Mobil m3 = new Mobil("Mazda", "B15469", 2016);
Mobil m4 = new Mobil("Honda", "AA1024", 2020);
Mobil m5 = new Mobil("Daihatsu", "D14522", 2017);
//pembentukan objek data pemilik
Pemilik p = new Pemilik("Sudarnam", "Surabaya");
//PENGHUBUNG ANTARA CLASS PEMILIK DAN MOBIL
p.setnoPlatMobil(m1.getNoPlat());
p.setnoPlatMobil(m2.getNoPlat());
p.setnoPlatMobil(m3.getNoPlat());
p.setnoPlatMobil(m4.getNoPlat());
p.setnoPlatMobil(m5.getNoPlat());
//menampilkan data pemilik
System.out.println("Pemilik: ");
System.out.println("Nama : "+p.getNama());
System.out.println("Alamat : "+p.getAlamat());
//MENAMPILKAN DATA MOBIL
System.out.println("Mobil: ");
System.out.println("");
System.out.println(m1.getMerek()+"-"+m1.getNoPlat()+"-"+m1.getTahunKeluaran());
System.out.println(m2.getMerek()+"-"+m2.getNoPlat()+"-"+m2.getTahunKeluaran());
System.out.println(m3.getMerek()+"-"+m3.getNoPlat()+"-"+m3.getTahunKeluaran());
System.out.println(m4.getMerek()+"-"+m4.getNoPlat()+"-"+m4.getTahunKeluaran());
System.out.println(m5.getMerek()+"-"+m5.getNoPlat()+"-"+m5.getTahunKeluaran());
//menampilkan jumlah mobil milik pemilik
int jml = p.getJumlahMobil();
System.out.println("Jumlah Mobil : "+jml);
}
}