-
Notifications
You must be signed in to change notification settings - Fork 77
Expand file tree
/
Copy pathDemoMain.java
More file actions
25 lines (20 loc) · 807 Bytes
/
DemoMain.java
File metadata and controls
25 lines (20 loc) · 807 Bytes
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
/*
* Utility class to execute DemoUseInterfaceCar.java and DemoInterfaceCar.java
*/
public class DemoMain {
public static void main(String[] args) {
// Declare and initialize a DemoUseInterfaceCar object
DemoUseInterfaceCar demoCar = new DemoUseInterfaceCar(7, 5.65);
// call getter methods of demoCar object
int numberOfPassengers = demoCar.getNumberPassengers();
double speed = demoCar.getSpeed();
double getTooFastKph = demoCar.getTooFastKPH();
// Output instance variables of the demoCar object
System.out.println("Number of passengers: " + numberOfPassengers);
System.out.println("Get speed: " + speed);
System.out.println("Get too fast kph: " + getTooFastKph);
// call methods of demoCar object
demoCar.slowDown(5.5);
demoCar.speedUp(6.38);
}
}