Public abstract class Motovehicle {
String No = "";
String brand = "";
String color;
int mileage;
int sum;
public abstract int Calcrent (int. days);
}
Public final class Car extends Motovehicle {
Private String type;
public int calcrent (int. days) {
return 0;
}
public int calcrent (int days, String type) {
Switch (type) {
Case "1":
sum = * days;
Break
Case "2":
sum = * days;
Break
Case "3":
sum = * days;
Break
}
System.out.println ("Rental car fee" + sum);
return sum;
}
}
Public final class Bus extends Motovehicle {
private int setcount;
Public Bus (String No, int setcount) {
This. no = no;
This.setcount = SetCount;
}
@Override
public int calcrent (int. days) {
return 0;
}
public int caclrent (int days, int setcount) {
if (SetCount <= 16) {
sum = * days;
} else if (SetCount > 16) {
sum = * days;
}
System.out.println ("Cost of renting a passenger car" + sum);
return sum;
}
}
public class Test111 {
public static void Main (string[] args) {
SYSTEM.OUT.PRINTLN ("************** welcome into Ascendas Car rental company **********************");
Scanner input = new Scanner (system.in);
System.out.println ("Please enter the number selection model (1. Sedan 2. Passenger car)");
int num = Input.nextint ();
if (num==1) {
SYSTEM.OUT.PRINTLN ("Buick Business Class GL8");
System.out.println ("BMW 550i");
System.out.println ("Buick Boulevard");
System.out.println ("Please enter a number to select a car brand");
String B = Input.next ();
System.out.println ("Please enter the lease days");
int c = Input.nextint ();
Car car = new car ();
Car. Calcrent (c, b);
}else if (num==2) {
System.out.println ("Please enter the number of seats:");
int d = Input.nextint ();
System.out.println ("Please Enter rental days:");
int e = Input.nextint ();
Bus bus = new Bus ("0", D);
Bus. Caclrent (E, D);
}
}
}
Java Car Rental Source code