Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class CarRental {
- protected String rentalName;
- protected int zipCode;
- protected int carSize;
- protected double rentalFee;
- protected int lengthRental;
- protected double totalRental;
- protected double dailyRate;
- CarRental(String rentalName2,int zipCode2,int carSize2,double rentalFee2,int lengthRental2,double totalRental2){
- rentalName = rentalName2;
- zipCode = zipCode2;
- carSize = carSize2;
- rentalFee = rentalFee2;
- lengthRental = lengthRental2;
- totalRental = totalRental2;
- if(carSize == 1){
- // Economy
- dailyRate = 29.99;
- }else if(carSize == 2){
- // midsize
- dailyRate = 38.99;
- }else if(carSize == 3) {
- // full
- dailyRate = 43.35;
- }
- }
- public void display(){
- System.out.print("Rental's Name: " +rentalName);
- System.out.print("Rental's ZipCode: " +rentalName);
- System.out.print("Car Size: " +rentalName);
- System.out.print("Rental's Name: " +rentalName);
- System.out.print("Rental's Name: " +rentalName);
- }
- }
- class LuxuryRentalCar extends CarRental {
- LuxuryRentalCar(String rentalName2,int zipCode2,int carSize2,double rentalFee2,int lengthRental2,double totalRental2){
- super(rentalName2,zipCode2,carSize2,rentalFee2,lengthRental2,totalRental2);
- Scanner sc = new Scanner(System.in);
- int sel;
- boolean chaff = false;
- if(carSize == 4){
- // Lux
- dailyRate = 79.99;
- }
- System.out.print("Do you need a Chauffeur? (1 = Yes/0 = No)");
- sel = sc.nextInt();
- if(sel == 1){
- chaff = true;
- }
- @public void display(){
- super.display();
- }
- }
- }
- class UseCarRental{
- public static void main(String[] args){
- // CarRental C1 = new CarRental();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement