Advertisement
Zaksofon

Untitled

Mar 1st, 2020
214
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 3.00 KB | None | 0 0
  1. using System;
  2.  
  3. namespace _02._Exam___Godzila_vs_King_Kong
  4. {
  5.     class Program
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.             String month = Console.ReadLine();
  10.             Double hours = double.Parse(Console.ReadLine());
  11.             Double customers = Double.Parse(Console.ReadLine());
  12.             string dayOrNight = Console.ReadLine();
  13.             double dayMoneyCounter = 0;
  14.             double nightMoneyCounter = 0;
  15.  
  16.             if (month == "march" || month == "april" || month == "may")
  17.             {
  18.                 Double dayPrice = 10.50;
  19.                 Double nightPrice = 8.40;
  20.                 Double dayPriceTotal = dayPrice * hours * customers;
  21.                 Double nightPriceTotal = nightPrice * hours * customers;
  22.                 if (dayOrNight == "day")
  23.                 {
  24.                     dayMoneyCounter += dayPriceTotal;
  25.                 }
  26.                 else if (dayOrNight == "night")
  27.                 {
  28.                     nightMoneyCounter += nightPriceTotal;
  29.                 }
  30.                 if (customers >= 4)
  31.                 {
  32.                     dayMoneyCounter *= 0.9;
  33.                     nightMoneyCounter *= 0.9;
  34.                 }
  35.                 else if (hours >= 5)
  36.                 {
  37.  
  38.                     dayMoneyCounter *= 0.5;
  39.                     nightMoneyCounter *= 0.5;
  40.                 }
  41.             }
  42.             if (month == "june" || month == "july" || month == "august")
  43.             {
  44.                 Double dayPrice = 12.60;
  45.                 Double nightPrice = 10.20;
  46.                 Double dayPriceTotal = dayPrice * hours * customers;
  47.                 Double nightPriceTotal = nightPrice * hours * customers;
  48.                 if (dayOrNight == "day")
  49.                 {
  50.                     dayMoneyCounter += dayPriceTotal;
  51.                 }
  52.                 else if (dayOrNight == "night")
  53.                 {
  54.                     nightMoneyCounter += nightPriceTotal;
  55.                 }
  56.                 if (customers >= 4)
  57.                 {
  58.                     dayMoneyCounter *= 0.9;
  59.                     nightMoneyCounter *= 0.9;
  60.                 }
  61.                 if (hours >= 5)
  62.                 {
  63.                     dayMoneyCounter *= 0.5;
  64.                     nightMoneyCounter *= 0.5;
  65.                 }
  66.             }
  67.             Double pricePerPersonFor1Hourday = dayMoneyCounter / (hours * customers);
  68.             Double pricePerPersonFor1Hournight = nightMoneyCounter / (hours * customers);
  69.             if (dayOrNight == "day")
  70.             {
  71.                 Console.WriteLine($"Price per person for one hour: {pricePerPersonFor1Hourday:f2}");
  72.                 Console.WriteLine($"Total cost of the visit: {dayMoneyCounter:f2}");
  73.             }
  74.             else if (dayOrNight == "night")
  75.             {
  76.                 Console.WriteLine($"Price per person for one hour: {pricePerPersonFor1Hournight:f2}");
  77.                 Console.WriteLine($"Total cost of the visit: {nightMoneyCounter:f2}");
  78.             }
  79.         }
  80.     }
  81. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement