0% found this document useful (0 votes)
31 views4 pages

Car Class

Uploaded by

Mx A
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
31 views4 pages

Car Class

Uploaded by

Mx A
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 4

Car Class

public class Car {


private String brand;
private String color;
private String model;

public Car(String brand, String color, String model) {


this.brand = brand;
this.color = color;
this.model = model;
}

public String getBrand() {


return brand;
}

public void setBrand(String brand) {


this.brand = brand;
}

public String getColor() {


return color;
}

public void setColor(String color) {


this.color = color;
}

public String getModel() {


return model;
}

public void setModel(String model) {


this.model = model;
}
public String getcarList(){
ArrayList <Car> getcarList = new ArrayList();{

Car c1=new Car("Toyota","White","2015" );


getcarList.add(c1);
Car c2=new Car("Bmw","White","2016" );
getcarList.add(c2);
Car c3=new Car("mercedes","Black","2014" );
getcarList.add(c3);
Car c4=new Car("Nissan","Silver","2010" );
getcarList.add(c4);
for(int i = 0; i < getcarList.size(); i++) {
System.out.println(getcarList.get(i));

}
}
return ".";

@Override
public String toString() {
return"\n Brand:" + " "+brand +"|"+ "Color:" +" "+ color +"|"+ " Model:" +" "+ model+"\n" ;
}
}

Customer Class
public class Customer {
private int age;
private String name;
private String nationality;
private String IDnum;
public Customer(int age, String name, String nationality, String IDnum) {
this.age= age;
this.name= name;
this.nationality= nationality;
this.IDnum = IDnum;
}

public int getAge() {


return age;
}

public void setAge(int age) {


this.age = age;
}

public String getName() {


return name;
}

public void setName(String name) {


this.name = name;
}

public String getNationality() {


return nationality;
}

public void setNationality(String nationality) {


this.nationality = nationality;
}

public String getIDnum() {


return IDnum;
}

public void setIDnum(String IDnum) {


this.IDnum = IDnum;
}
public Boolean getTheLegalAge() {

if (age >= 18) {

return true;

} else {

return false;

}
@Override
public String toString() {
return "age=" + age + ", name=" + name + ", nationality=" + nationality + ", IDnum=" + IDnum + '}';
}}

Payment Class

public class Payment {


private int cash;
private int premium;

public Payment(int cash, int premium) {


this.cash = cash;
this.premium = premium;
}

public int getCash() {


return cash;
}

public void setCash(int cash) {


this.cash = cash;
}

public int getPremium() {


return premium;
}

public void setPremium(int premium) {


this.premium = premium;
}

@Override
public String toString() {
return "Payment{" + "cash=" + cash + ", premium=" + premium + '}';
}

}
Car Showroom

You might also like