Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package _03_ConditionalStatementsAdvanced;
- import java.util.Scanner;
- public class Cinema {
- public static void main(String[] args) {
- Scanner scanner = new Scanner(System.in);
- String ticketType = scanner.nextLine();
- int rows = Integer.parseInt(scanner.nextLine());
- int columns = Integer.parseInt(scanner.nextLine());
- int seatsAll = rows * columns;
- double totalPrice = 0.0;
- // if (ticketType.equals("Premiere")) {
- // totalPrice = 12.0 * seatsAll;
- // } else if (ticketType.equals("Normal")) {
- // totalPrice = 7.50 * seatsAll;
- // } else if (ticketType.equals("Discount")) {
- // totalPrice = 5.0 * seatsAll;
- // }
- switch (ticketType) {
- case "Premiere":
- totalPrice = 12.0 * seatsAll;
- break;
- case "Normal":
- totalPrice = 7.50 * seatsAll;
- break;
- case "Discount":
- totalPrice = 5.0 * seatsAll;
- break;
- }
- System.out.printf("%.2f leva", totalPrice);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement