Advertisement
Guest User

Untitled

a guest
May 22nd, 2019
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.00 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class Main {
  4.  
  5.     public static void main(String[] args) {
  6.         char rooms;
  7.         Scanner s = new Scanner(System.in);
  8.         System.out.print("If you have a duplex enter \"y\" else enter Quantity of rooms");
  9.         rooms = s.next().charAt(0);//Save the input as char *
  10.             switch(rooms){//Checking what he input was *
  11.                 case 'y':
  12.                     System.out.print("You have to pay: "+200);
  13.                     break;
  14.                 case '5':
  15.                     System.out.print("You have to pay: "+180);
  16.                     break;
  17.                 case '4':
  18.                     System.out.print("You have to pay: "+150);
  19.                     break;
  20.                 case '3':
  21.                     System.out.print("You have to pay: "+120);
  22.                     break;
  23.                 default ://Alert message if the input was wrong
  24.                     System.out.print("enter room number between 3-5");
  25.             }
  26.     }
  27.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement