Advertisement
Guest User

Untitled

a guest
Mar 19th, 2018
137
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.54 KB | None | 0 0
  1. import java.util.Scanner;
  2. public class bush {
  3.  
  4. public static void main(String[] args) {
  5. int economy = 35;
  6. int compact = 45;
  7. int standard = 95;
  8. double base = 0;
  9. int choice = 0;
  10. int days = 0;
  11. int member = 0;
  12. int PEP = 0;
  13. int discount = 0;
  14. double exec = 0;
  15.  
  16. Scanner in = new Scanner (System.in);
  17.  
  18. System.out.println("Available cars: 1 for Economy, 2 for Compact, 3 for Standard");
  19. System.out.println("Please choose the rental car: ");
  20. choice = in.nextInt();
  21.  
  22. System.out.print("Please enter the number of rental days: ");
  23. days = in.nextInt();
  24.  
  25. System.out.print("Club member: 1 for yes, 0 for no: ");
  26. member = in.nextInt();
  27.  
  28.  
  29. if (member == 1) {
  30. System.out.println("Plantinum Executive Package?: 1 for yes, 0 for no: ");
  31. PEP = in.nextInt();}
  32.  
  33.  
  34. if (choice == 1) {
  35. base = ((double)(economy * days));
  36. System.out.println("Base: " + days + " days for economy @ $35 per day: $" + (base));
  37.  
  38. if (member == 1) {
  39. discount = ((days / 7)*economy);
  40. System.out.println("Club member discount: -$" + discount );}
  41.  
  42. if (PEP == 1) {
  43. exec = (base * 0.15);
  44. System.out.println("Platinum Executive Package: +$" + (exec));}
  45.  
  46.  
  47. }else if (choice == 2) {
  48. base = ((double)(compact * days));
  49. System.out.println("Base: " + days + " days for compact @ $45 per day: $" + (base));
  50.  
  51. if (member == 1) {
  52. discount = ((days / 7)*compact);
  53. System.out.println("Club member discount: -$" + discount );}
  54.  
  55. if (PEP == 1) {
  56. exec = (base * 0.15);
  57. System.out.println("Platinum Executive Package: +$" + (exec));}
  58. System.out.println("Total Estimate for Rental: $" + (double)(base-discount+exec));
  59.  
  60. if (choice == 3) {
  61. base = ((double)(standard * days));
  62. System.out.println("Base: " +days + " days for compact @ $45 per day: $" + (base));}
  63. if (member == 1) {
  64. discount = ((days / 7)*standard);
  65. System.out.println("Club member discount : -$" + discount);}
  66. if (PEP == 1) {
  67. exec = (base * 0.15);
  68. System.out.println("Platinum Executive Package: +$" + (exec));}
  69.  
  70. }
  71. }
  72. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement