SHARE
TWEET

Untitled

a guest Mar 24th, 2019 75 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5.  
  6. namespace Exam_March_2019
  7. {
  8.     class MainClass
  9.     {
  10.         struct Equipment
  11.         {
  12.             public static int Treadmill = 5899;
  13.             public static int CrossTrainer = 1699;
  14.             public static int ExerciseBike = 1789;
  15.             public static int Dumbells = 579;
  16.         }
  17.  
  18.         public static void Main(string[] args)
  19.         {
  20.             float equipmentCost = 0;
  21.  
  22.             int inputQuantity = int.Parse(Console.ReadLine());
  23.             for (int i = 0; i < inputQuantity; i++)
  24.             {
  25.                 string item = Console.ReadLine();
  26.  
  27.                 if (item.Equals("treadmill"))
  28.                 {
  29.                     equipmentCost += Equipment.Treadmill;
  30.                 }
  31.                 else if (item.Equals("exercise bike"))
  32.                 {
  33.                     equipmentCost += Equipment.ExerciseBike;
  34.                 }
  35.                 else if (item.Equals("cross trainer"))
  36.                 {
  37.                     equipmentCost += Equipment.CrossTrainer;
  38.                 }
  39.                 else if(item.Equals("dumbbells"))
  40.                 {
  41.                     equipmentCost += Equipment.Dumbells;
  42.                 }
  43.  
  44.             }
  45.  
  46.             Console.WriteLine("{0:F2}", equipmentCost);
  47.  
  48.         }
  49.     }
  50. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top