Advertisement
desislava_topuzakova

03. Fitness Card

Mar 31st, 2020
250
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 2.30 KB | None | 0 0
  1. using System;
  2.  
  3. namespace _03._Fitness_Card
  4. {
  5.     class Program
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.             double budget = double.Parse(Console.ReadLine());
  10.             char gender = char.Parse(Console.ReadLine());
  11.             int age = int.Parse(Console.ReadLine());
  12.             string sport = Console.ReadLine();
  13.  
  14.             double price = 0;
  15.             if (gender == 'm')
  16.             {
  17.                 switch (sport)
  18.                 {
  19.                     case "Gym":
  20.                         price = 42;
  21.                         break;
  22.                     case "Boxing":
  23.                         price = 41;
  24.                         break;
  25.                     case "Yoga":
  26.                         price = 45;
  27.                         break;
  28.                     case "Zumba":
  29.                         price = 34;
  30.                         break;
  31.                     case "Dances":
  32.                         price = 51;
  33.                         break;
  34.                     case "Pilates":
  35.                         price = 39;
  36.                         break;
  37.                 }
  38.             }
  39.             else
  40.             {
  41.                 switch (sport)
  42.                 {
  43.                     case "Gym":
  44.                         price = 35;
  45.                         break;
  46.                     case "Boxing":
  47.                         price = 37;
  48.                         break;
  49.                     case "Yoga":
  50.                         price = 42;
  51.                         break;
  52.                     case "Zumba":
  53.                         price = 31;
  54.                         break;
  55.                     case "Dances":
  56.                         price = 53;
  57.                         break;
  58.                     case "Pilates":
  59.                         price = 37;
  60.                         break;
  61.                 }
  62.             }
  63.  
  64.             if (age <= 19)
  65.             {
  66.                 price -= price * 0.2;
  67.             }
  68.  
  69.             if (budget >= price)
  70.             {
  71.                 Console.WriteLine($"You purchased a 1 month pass for {sport}.");
  72.             }
  73.             else
  74.             {
  75.                 double needMoney = price - budget;
  76.                 Console.WriteLine($"You don't have enough money! You need ${needMoney:F2} more.");
  77.             }
  78.         }
  79.     }
  80. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement