Kulas_Code20

Vehicle Rental Service Rate

Jun 24th, 2021
128
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 2.17 KB | None | 0 0
  1. import java.util.Scanner;
  2. public class Main
  3. {
  4.     public static void main(String[] args) {
  5.         Scanner sc = new Scanner(System.in);
  6.         int rent;
  7.         double total;
  8.         System.out.println("+-----------------------------------------------+");
  9.         System.out.println("|           Vehicle Rental Service Rate         |");
  10.         System.out.println("+-----------------------------------------------+");
  11.         System.out.println("|            Vehicle         |   Rate per Day   |");
  12.         System.out.println("+----------------------------+------------------+");
  13.         System.out.println("|  [1] 4-Seater Sedan        |     1,100.00     |");
  14.         System.out.println("|  [2] 6-Seater SUV          |     1,800.00     |");
  15.         System.out.println("|  [3] 12-Seater Van         |     2,500.00     |");
  16.         System.out.println("|  [4] 4-Seater Pickup truck |     1,400.00     |");
  17.         System.out.println("+----------------------------+------------------+");
  18.        
  19.         System.out.print("Enter your choice: ");
  20.         int vehicle = sc.nextInt();
  21.        
  22.         switch(vehicle){
  23.             case 1:
  24.                 System.out.println("4-Seater Sedan");
  25.                 System.out.print("How many days you want to rent?: ");
  26.                 rent = sc.nextInt();
  27.                 total = rent*1100.00;
  28.                 System.out.println("Amount to be paid is: "+total);
  29.                 break;
  30.             case 2:
  31.                 System.out.println("6-Seater SUV");
  32.                 System.out.print("How many days you want to rent?: ");
  33.                 rent = sc.nextInt();
  34.                 total = rent*1800.00;
  35.                 System.out.println("Amount to be paid is: "+total);
  36.                 break;
  37.             case 3:
  38.                 System.out.println("4-Seater Sedan");
  39.                 System.out.print("How many days you want to rent?: ");
  40.                 rent = sc.nextInt();
  41.                 total = rent*2500.00;
  42.                 System.out.println("Amount to be paid is: "+total);
  43.                 break;
  44.             case 4:
  45.                 System.out.println("4-Seater Pickup truck ");
  46.                 System.out.print("How many days you want to rent?: ");
  47.                 rent = sc.nextInt();
  48.                 total = rent*1400.00;
  49.                 System.out.println("Amount to be paid is: "+total);
  50.                 break;
  51.             default:
  52.                 System.out.println("Invalid Input!");
  53.         }
  54.     }
  55. }
  56.  
Advertisement
Add Comment
Please, Sign In to add comment