Skip to content

Commit 6f62632

Browse files
committed
Java Objects
1 parent 086d8d2 commit 6f62632

1 file changed

Lines changed: 19 additions & 0 deletions

File tree

src/Car.java

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
public class Car {
2+
private int doors;
3+
private int wheels;
4+
private String models;
5+
private String Engine;
6+
7+
public void setModels(String models){
8+
String validModel=models.toLowerCase();
9+
if(validModel.equals("carrera")||validModel.equals("commodor")) {
10+
this.models = models;
11+
}
12+
else
13+
this.models="unknown";
14+
}
15+
16+
public String getModels() {
17+
return this.models;
18+
}
19+
}

0 commit comments

Comments
 (0)