Java Car Rental Source code

Source: Internet
Author: User

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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.