Advertisement
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) {
- char rooms;
- Scanner s = new Scanner(System.in);
- System.out.print("If you have a duplex enter \"y\" else enter Quantity of rooms");
- rooms = s.next().charAt(0);//Save the input as char *
- switch(rooms){//Checking what he input was *
- case 'y':
- System.out.print("You have to pay: "+200);
- break;
- case '5':
- System.out.print("You have to pay: "+180);
- break;
- case '4':
- System.out.print("You have to pay: "+150);
- break;
- case '3':
- System.out.print("You have to pay: "+120);
- break;
- default ://Alert message if the input was wrong
- System.out.print("enter room number between 3-5");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement