Use cases
1: MP - is a person who won from a constituency
2: MP spending limit is only 50000 rupees
2: Constituency is a place with a name and area of sq KM
3: Minister is MP, but minister have spending limit of 70,000
4: Minister also have a car , and a driver is also assigned to him
5: Driver assigned to Minister is a person who can drive car
6: PM is Minister, but PM have spending limit of 170,000
7: PM can have minimum one and maximum 5 cars,
Answers
Answer:
5 car mark me a brainlist answer
Answer:
Explanation:
package data.structure.java;
class person{
private String name;
private String noOfVehicle;
private String vehicle1;
private String Vehicle2;
void setPersonDetails(String newName,String noOfVehicle,String vehicle1,String vehicle2){
this.name=newName;
this.noOfVehicle=noOfVehicle;
this.vehicle1=vehicle1;
this.Vehicle2=vehicle2;
}
void getPersonDetails(){
System.out.println(name+" has "+noOfVehicle+",vehicle one is "+vehicle1+" and another is "+Vehicle2 );
}
}
class vehicle {
protected String fuel;
protected String uses;
protected String operation;
static class hondaAccordCar extends vehicle{
void sethondaAccordCar(String newfuel,String uses,String madein){
this.fuel=newfuel;
this.uses= uses;
this.operation=madein;
}
void getHondaAccordCar(){
System.out.println("Honda accord car runs on fuel called "+fuel);
System.out.println("Honda accord is "+uses+" and "+operation+" in India");
}
}
static class DucatiBike extends vehicle{
void setDucatiBike(String newFuel,String uses,String imported){
this.fuel= newFuel;
this.uses=uses;
this.operation=imported;
}
void getDucatiBike(){
System.out.println("Ducati runs on fuel called "+fuel);
System.out.println("Ducati is "+uses+" and "+operation+" vehicle");
}
}
public static void main(String[] args) {
// creating object for person whose name is sourabh
person p = new person();
p.setPersonDetails("Sourabh","two","honda accord car","Ducati Bike");
p.getPersonDetails();
// creating object forHonda accord car
hondaAccordCar h = new hondaAccordCar();
h.sethondaAccordCar("diesel","new","made");
h.getHondaAccordCar();
// creatting object for Ducati Bike
DucatiBike d = new DucatiBike();
d.setDucatiBike("petrol","used","imported");
d.getDucatiBike();
}
}