Advertisement
veronikaaa86

01. Cinema

Jun 20th, 2021
160
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.80 KB | None | 0 0
  1. package advancedConditionalStatements;
  2.  
  3. import java.util.Scanner;
  4.  
  5. public class P01Cinema {
  6. public static void main(String[] args) {
  7. Scanner scanner = new Scanner(System.in);
  8.  
  9. String type = scanner.nextLine();
  10. int rows = Integer.parseInt(scanner.nextLine());
  11. int cols = Integer.parseInt(scanner.nextLine());
  12.  
  13. int allSeats = rows * cols;
  14.  
  15. double price = 0;
  16. switch (type) {
  17. case "Premiere":
  18. price = 12;
  19. break;
  20. case "Normal":
  21. price = 7.50;
  22. break;
  23. case "Discount":
  24. price = 5.00;
  25. break;
  26. }
  27.  
  28. double result = allSeats * price;
  29.  
  30. System.out.printf("%.2f leva", result);
  31. }
  32. }
  33.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement