Advertisement
desislava_topuzakova

01. Cinema

Jun 20th, 2021
667
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.17 KB | None | 0 0
  1. using System;
  2.  
  3. namespace Demo
  4. {
  5.     class Program
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.             //крайна сума = бр. билети (редове * колони) * цена за 1 билет(зависи от вида на прожекцията)
  10.             string type = Console.ReadLine();
  11.             int rows = int.Parse(Console.ReadLine());
  12.             int cols = int.Parse(Console.ReadLine());
  13.  
  14.             int countTickets = rows * cols;
  15.             double ticketPrice = 0;
  16.  
  17.             //•   Premiere –  12.00 лева.
  18.             //•   Normal –  7.50 лева.
  19.             //•   Discount –  5.00 лева.
  20.  
  21.             switch (type)
  22.             {
  23.                 case "Premiere": //type == "Premiere"
  24.                     ticketPrice = 12;
  25.                     break;
  26.                 case "Normal":
  27.                     ticketPrice = 7.50;
  28.                     break;
  29.                 case "Discount":
  30.                     ticketPrice = 5;
  31.                     break;
  32.             }
  33.  
  34.             double finalSum = countTickets * ticketPrice;
  35.             Console.WriteLine($"{finalSum:F2} leva");
  36.  
  37.         }
  38.     }
  39. }
  40.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement