-
Notifications
You must be signed in to change notification settings - Fork 88
Expand file tree
/
Copy pathMotorcycle.java
More file actions
38 lines (35 loc) · 1005 Bytes
/
Motorcycle.java
File metadata and controls
38 lines (35 loc) · 1005 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
26
27
28
29
30
31
32
33
34
35
36
37
38
public class Motorcycle {
String make;
String color;
boolean engiceState;
void startEngine(){
if (engiceState){
System.out.println("the engine is already on");
}
else {
System.out.println("the engine is now on");
}
}
void showAtts(){
System.out.println("this motorcycle is a"+color+" "+make+".");
if (engiceState){
System.out.println("the engine is on");
}
else {
System.out.println("the engine is off");
}
}
public static void main(String args[]) {
Motorcycle m = new Motorcycle();
m.make = "Yamaha RZ350";
m.color = "yellow";
System.out.println("calling showAtts...");
m.showAtts();
System.out.println("Starting engine...");
m.startEngine();
System.out.println("calling showAtts...");
m.showAtts();
System.out.println("Starting engine...");
m.startEngine();
}
}