Advertisement
veronikaaa86

01. Cinema

Jan 23rd, 2022
311
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.81 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 columns = Integer.parseInt(scanner.nextLine());
  12.  
  13. double price = 0;
  14. switch (type) {
  15. case "Premiere":
  16. price = 12;
  17. break;
  18. case "Normal":
  19. price = 7.50;
  20. break;
  21. case "Discount":
  22. price = 5;
  23. break;
  24. }
  25.  
  26. int allSeats = rows * columns;
  27. double totalPrice = allSeats * price;
  28.  
  29. System.out.printf("%.2f leva", totalPrice);
  30. }
  31. }
  32.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement