Advertisement
Fakhru

Untitled

Sep 3rd, 2014
347
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.14 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class CarRental {
  4. protected String rentalName;
  5. protected int zipCode;
  6. protected int carSize;
  7. protected double rentalFee;
  8. protected int lengthRental;
  9. protected double totalRental;
  10. protected double dailyRate;
  11.  
  12.  
  13. CarRental(String rentalName2,int zipCode2,int carSize2,double rentalFee2,int lengthRental2,double totalRental2){
  14. rentalName = rentalName2;
  15. zipCode = zipCode2;
  16. carSize = carSize2;
  17. rentalFee = rentalFee2;
  18. lengthRental = lengthRental2;
  19. totalRental = totalRental2;
  20.  
  21. if(carSize == 1){
  22. // Economy
  23. dailyRate = 29.99;
  24. }else if(carSize == 2){
  25. // midsize
  26. dailyRate = 38.99;
  27. }else if(carSize == 3) {
  28. // full
  29. dailyRate = 43.35;
  30. }
  31.  
  32.  
  33.  
  34. }
  35.  
  36.  
  37. public void display(){
  38.  
  39.  
  40.  
  41.  
  42. System.out.print("Rental's Name: " +rentalName);
  43. System.out.print("Rental's ZipCode: " +rentalName);
  44. System.out.print("Car Size: " +rentalName);
  45. System.out.print("Rental's Name: " +rentalName);
  46. System.out.print("Rental's Name: " +rentalName);
  47. }
  48.  
  49. }
  50.  
  51.  
  52. class LuxuryRentalCar extends CarRental {
  53.  
  54. LuxuryRentalCar(String rentalName2,int zipCode2,int carSize2,double rentalFee2,int lengthRental2,double totalRental2){
  55. super(rentalName2,zipCode2,carSize2,rentalFee2,lengthRental2,totalRental2);
  56. Scanner sc = new Scanner(System.in);
  57. int sel;
  58. boolean chaff = false;
  59.  
  60. if(carSize == 4){
  61. // Lux
  62. dailyRate = 79.99;
  63. }
  64. System.out.print("Do you need a Chauffeur? (1 = Yes/0 = No)");
  65. sel = sc.nextInt();
  66. if(sel == 1){
  67. chaff = true;
  68. }
  69.  
  70. @public void display(){
  71. super.display();
  72. }
  73.  
  74.  
  75.  
  76.  
  77. }
  78.  
  79. }
  80.  
  81. class UseCarRental{
  82. public static void main(String[] args){
  83.  
  84.  
  85. // CarRental C1 = new CarRental();
  86.  
  87. }
  88. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement