tsvetelinapasheva

HairSaloon

Feb 27th, 2021
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.86 KB | None | 0 0
  1. using System;
  2.  
  3. namespace ConsoleApp42
  4. {
  5.     class Program
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.             int purposeForDay = int.Parse(Console.ReadLine());
  10.             string service = Console.ReadLine();
  11.             int price = 0;
  12.             double endSum = 0;
  13.             while (service != "closed")
  14.             {
  15.                 if (service == "haircut" )
  16.                 {
  17.                     string choice = Console.ReadLine();
  18.                     if (choice == "mens")
  19.                     {
  20.                         price = 15;
  21.                     }
  22.                     else if (choice == "ladies")
  23.                     {
  24.                         price = 20;
  25.                     }
  26.                     else if (choice == "kids")
  27.                     {
  28.                         price = 10;
  29.                     }
  30.  
  31.                 }
  32.                 if (service == "color")
  33.                 {
  34.                     string choice = Console.ReadLine();
  35.                     if (choice == "touch up")
  36.                     {
  37.                         price = 20;
  38.                     }
  39.                     else if (choice == "full color")
  40.                     {
  41.                         price = 30;
  42.                     }
  43.                 }
  44.                 endSum += price;
  45.                 if (endSum >= purposeForDay)
  46.                 {
  47.                     break;
  48.                 }
  49.                service = Console.ReadLine();
  50.             }
  51.             if (endSum >= purposeForDay)
  52.             {
  53.                 Console.WriteLine("You have reached your target for the day!");
  54.             }
  55.             else if (endSum < purposeForDay)
  56.             {
  57.                 Console.WriteLine($"Target not reached! You need {purposeForDay - endSum}lv. more.");
  58.             }
  59.             Console.WriteLine($"Earned money: {endSum}lv.");
  60.         }
  61.     }
  62. }
  63.  
Advertisement
Add Comment
Please, Sign In to add comment