desislava_topuzakova

03. Cinema

Nov 22nd, 2020
288
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.34 KB | None | 0 0
  1. using System;
  2.  
  3. namespace _09.Cinema
  4. {
  5.     class Program
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.             //броят на билетите = броят на местата
  10.             //броят на местата = ред * колоните
  11.             //приход = броя на местата * цена на билета
  12.  
  13.             //1. вход
  14.             //2. броят на местата
  15.             //3. цена на билета -> вид на прожекция
  16.             //4. изчисляваме и принтираме прихода
  17.  
  18.             string type = Console.ReadLine(); //Premiere, Normal, Discount  
  19.             int rows = int.Parse(Console.ReadLine());
  20.             int cols = int.Parse(Console.ReadLine());
  21.  
  22.             int countTickets = rows * cols;
  23.             double priceTicket = 0;
  24.  
  25.             switch (type)
  26.             {
  27.                 case "Premiere":
  28.                     priceTicket = 12;
  29.                     break;
  30.                 case "Normal":
  31.                     priceTicket = 7.50;
  32.                     break;
  33.                 case "Discount":
  34.                     priceTicket = 5;
  35.                     break;
  36.             }
  37.  
  38.             double income = countTickets * priceTicket;
  39.             Console.WriteLine($"{income:F2} leva");
  40.  
  41.  
  42.         }
  43.     }
  44. }
  45.  
Add Comment
Please, Sign In to add comment