Advertisement
veselka_a

6.EasternDecoration

Feb 24th, 2020
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.68 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace _6.EasternDecoration
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.            // double basketPr = 1.5;
  14.            // double wreathPr = 3.8;
  15.            // double chocolateBunnyPr = 5;
  16.             int items = 0;
  17.             double sumPerClient = 0.0;
  18.             double totalSum = 0.0;
  19.             //int wreaths = 0;
  20.            // int chocolateBunnys = 0;
  21.  
  22.             int clients = int.Parse(Console.ReadLine());
  23.             for (int i = 1; i <= clients; i++)
  24.             {
  25.                 string input = Console.ReadLine();
  26.                 while (input != "Finish")
  27.                 {
  28.                     switch (input)
  29.                     {
  30.                         case "basket": items++; sumPerClient += 1.5; break;
  31.                         case "wreath": items++; sumPerClient += 3.8; break;
  32.                         case "chocolate bunny": items++; sumPerClient += 7.0; break;
  33.                             // case "basket": items++;sumPerClient += 1.5;break;
  34.  
  35.                     }
  36.                     input = Console.ReadLine();
  37.                 }
  38.                 if (items%2==0)
  39.                 {
  40.                     sumPerClient = sumPerClient - sumPerClient * 0.2;
  41.                 }
  42.                 Console.WriteLine($"You purchased {items} items for {sumPerClient:f2} leva.");
  43.                 items = 0;
  44.                 totalSum += sumPerClient;
  45.                 sumPerClient = 0;
  46.             }
  47.  
  48.             Console.WriteLine($"Average bill per client is: {totalSum/clients:f2} leva.");
  49.  
  50.  
  51.         }
  52.     }
  53. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement