Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package ConditionalStatementsAdvanced;
- import java.util.Scanner;
- public class Cinema_01 {
- public static void main(String[] args) {
- Scanner scanner = new Scanner(System.in);
- String type = scanner.nextLine();
- int rows = Integer.parseInt(scanner.nextLine());
- int cols = Integer.parseInt(scanner.nextLine());
- //обща сума = бр. билетите (редове * колони) * цена на 1 билет (зависи от типа на прожекцията)
- int countTickets = rows * cols; //бр. билетите = бр. местата в залата
- double pricePerTicket = 0; //цена за 1 билет
- if (type.equals("Premiere")) {
- pricePerTicket = 12;
- } else if (type.equals("Normal")) {
- pricePerTicket = 7.50;
- } else if (type.equals("Discount")) {
- pricePerTicket = 5;
- }
- double totalSum = countTickets * pricePerTicket;
- System.out.printf("%.2f leva", totalSum);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment