Advertisement
Spocoman

Computer Room

Jun 25th, 2022 (edited)
47
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.40 KB | None | 0 0
  1. using System;
  2.  
  3. namespace ComputerRoom
  4. {
  5.     internal class Program
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.             string month = Console.ReadLine();
  10.             int hours = int.Parse(Console.ReadLine());
  11.             int people = int.Parse(Console.ReadLine());
  12.             string time = Console.ReadLine();
  13.             double price = 0;
  14.  
  15.             if (month == "march" || month == "april" || month == "may")
  16.             {
  17.                 if (time == "day")
  18.                 {
  19.                     price = 10.50;
  20.                     hours = 3;
  21.                 }
  22.                 else
  23.                 {
  24.                     price = 8.40;
  25.                 }
  26.             }
  27.  
  28.             else if (month == "june" || month == "july" || month == "august")
  29.             {
  30.                 if (time == "day")
  31.                 {
  32.                     price = 12.60;
  33.                 }
  34.                 else
  35.                 {
  36.                     price = 10.20;
  37.                 }
  38.             }
  39.  
  40.             if (people >= 4)
  41.             {
  42.                 price *= 0.9;
  43.             }
  44.  
  45.             if (hours >= 5)
  46.             {
  47.                 price /= 2;
  48.             }
  49.  
  50.             double total = price * people * hours;
  51.  
  52.             Console.WriteLine($"Price per person for one hour: {price:f2}");
  53.             Console.WriteLine($"Total cost of the visit: {total:f2}");
  54.         }
  55.     }
  56. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement