Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class Cinema {
- public static void main(String[] args) {
- Scanner scanner = new Scanner(System.in);
- String screeningType = scanner.nextLine();
- int rows = Integer.parseInt(scanner.nextLine());
- int columns = Integer.parseInt(scanner.nextLine());
- double ticketPrice = 0;
- if (screeningType.equals("Premiere")) {
- ticketPrice = 12.00;
- } else if (screeningType.equals("Normal")) {
- ticketPrice = 7.50;
- } else {
- ticketPrice = 5.00;
- }
- System.out.printf("%.2f leva\n", rows * columns * ticketPrice);
- }
- }
- ИЛИ:
- import java.util.Scanner;
- public class Cinema {
- public static void main(String[] args) {
- Scanner scanner = new Scanner(System.in);
- String screeningType = scanner.nextLine();
- int rows = Integer.parseInt(scanner.nextLine());
- int columns = Integer.parseInt(scanner.nextLine());
- double ticketPrice =
- screeningType.equals("Premiere") ? 12.00 :
- screeningType.equals("Normal") ? 7.50 : 5.00;
- System.out.printf("%.2f leva\n", rows * columns * ticketPrice);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement