Advertisement
Guest User

targuil1

a guest
May 22nd, 2019
170
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.94 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class targuil1 {
  4.     public static void main(String[] args) {
  5.         Scanner s= new Scanner (System.in);
  6.  
  7.         System.out.println("enter a num of a room between 3 and 5 ");
  8.         int numofroom, sum;
  9.         numofroom=s.nextInt();
  10.  
  11.         switch (numofroom){
  12.             case 3 :
  13.                sum=120;
  14.                 System.out.println("the sum is:"+sum);
  15.                break;
  16.             case 4:
  17.                 sum=150;
  18.                 System.out.println("the sum is:"+sum);
  19.                 break;
  20.         }
  21.         if(numofroom==5 ){
  22.             System.out.println("it's duplex ? y/n");
  23.              char a=s.next().charAt(0);
  24.              if(a=='y'){
  25.                  sum=200;
  26.                  System.out.println("the sum is:"+sum);
  27.              }
  28.              else {
  29.                  sum=180;
  30.                  System.out.println("the sum is:"+sum);
  31.              }
  32.         }
  33.  
  34.     }
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement