Advertisement
Guest User

01. Fitness Equipment

a guest
Feb 15th, 2020
160
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.14 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4.  
  5. namespace _8._02_ITCareer
  6. {
  7.     class Program
  8.     {
  9.         static void Main(string[] args)
  10.         {
  11.             //treadmill -> 5899
  12.             //cross trainer -> 1699
  13.             //exercise bike -> 1789
  14.             //dumbells -> 579
  15.  
  16.             int count = int.Parse(Console.ReadLine()); //5
  17.             int sum = 0;
  18.  
  19.  
  20.             for (int i = 1; i <= count; i++)
  21.             {
  22.                 //какъв е, цената
  23.                 string name = Console.ReadLine();
  24.                 switch(name)
  25.                 {
  26.                     case "treadmill":
  27.                         sum += 5899;
  28.                         break;
  29.                     case "cross trainer":
  30.                         sum += 1699;
  31.                         break;
  32.                     case "exercise bike":
  33.                         sum += 1789;
  34.                         break;
  35.                     case "dumbbells":
  36.                         sum += 579;
  37.                         break;
  38.  
  39.                 }
  40.             }
  41.  
  42.             Console.WriteLine($"{sum:F2}");
  43.  
  44.  
  45.         }
  46.     }
  47. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement