Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class Main
- {
- public static void main(String[] args) {
- Scanner sc = new Scanner(System.in);
- int rent;
- double total;
- System.out.println("+-----------------------------------------------+");
- System.out.println("| Vehicle Rental Service Rate |");
- System.out.println("+-----------------------------------------------+");
- System.out.println("| Vehicle | Rate per Day |");
- System.out.println("+----------------------------+------------------+");
- System.out.println("| [1] 4-Seater Sedan | 1,100.00 |");
- System.out.println("| [2] 6-Seater SUV | 1,800.00 |");
- System.out.println("| [3] 12-Seater Van | 2,500.00 |");
- System.out.println("| [4] 4-Seater Pickup truck | 1,400.00 |");
- System.out.println("+----------------------------+------------------+");
- System.out.print("Enter your choice: ");
- int vehicle = sc.nextInt();
- switch(vehicle){
- case 1:
- System.out.println("4-Seater Sedan");
- System.out.print("How many days you want to rent?: ");
- rent = sc.nextInt();
- total = rent*1100.00;
- System.out.println("Amount to be paid is: "+total);
- break;
- case 2:
- System.out.println("6-Seater SUV");
- System.out.print("How many days you want to rent?: ");
- rent = sc.nextInt();
- total = rent*1800.00;
- System.out.println("Amount to be paid is: "+total);
- break;
- case 3:
- System.out.println("4-Seater Sedan");
- System.out.print("How many days you want to rent?: ");
- rent = sc.nextInt();
- total = rent*2500.00;
- System.out.println("Amount to be paid is: "+total);
- break;
- case 4:
- System.out.println("4-Seater Pickup truck ");
- System.out.print("How many days you want to rent?: ");
- rent = sc.nextInt();
- total = rent*1400.00;
- System.out.println("Amount to be paid is: "+total);
- break;
- default:
- System.out.println("Invalid Input!");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment