galinyotsev123

ProgBasics04Nested-Statements-Y02cinema

Jan 6th, 2019
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.02 KB | None | 0 0
  1.  
  2. import java.util.Scanner;
  3. public class Y02cinema {
  4.  
  5. public static void main(String[] args) {
  6. Scanner console = new Scanner(System.in);
  7. String filmShow = console.nextLine().toLowerCase();
  8. int row = Integer.parseInt(console.nextLine());
  9. int column = Integer.parseInt(console.nextLine());
  10. double premierePrice = 12.00;
  11. double normalPrice = 7.50;
  12. double discountPrice = 5.00;
  13. double price = 0;
  14.  
  15. switch (filmShow) {
  16. case "premiere":
  17. price = row * column * premierePrice;
  18. break;
  19. case "normal":
  20. price = row * column * normalPrice;
  21. break;
  22. case "discount":
  23. price = row * column * discountPrice;
  24. break;
  25. default:
  26. System.out.println("No such filmshow.");
  27. break;
  28. }
  29.  
  30. if (price > 0) {
  31. System.out.printf("%.2f leva", price);
  32. }
  33. }
  34. }
Advertisement
Add Comment
Please, Sign In to add comment