Advertisement
Valantina

Gymnastics/EX

Jun 13th, 2019
113
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 2.72 KB | None | 0 0
  1. using System;
  2.  
  3. namespace Gymnastics
  4. {
  5.     class Program
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.             string country = Console.ReadLine();
  10.             string instrument = Console.ReadLine();
  11.             decimal difficulty = 0;
  12.             decimal performance = 0;
  13.             switch (country)
  14.             {
  15.                 case "Russia":
  16.                     {
  17.                         if (instrument == "ribbon")
  18.                         {
  19.                             difficulty = 9.1M;
  20.                             performance = 9.4M;
  21.                         }
  22.                         else if (instrument == "hoop")
  23.                         {
  24.                             difficulty = 9.3M;
  25.                             performance = 9.8M;
  26.                         }
  27.                         else
  28.                         {
  29.                             difficulty = 9.6M;
  30.                             performance = 9;
  31.                         }
  32.                         break;
  33.                     }
  34.                 case "Bulgaria":
  35.                     {
  36.                         if (instrument == "ribbon")
  37.                         {
  38.                             difficulty = 9.6M;
  39.                             performance = 9.4M;
  40.                         }
  41.                         else if (instrument == "hoop")
  42.                         {
  43.                             difficulty = 9.550M;
  44.                             performance = 9.750M;
  45.                         }
  46.                         else
  47.                         {
  48.                             difficulty = 9.5M;
  49.                             performance = 9.4M;
  50.                         }
  51.                         break;
  52.                     }
  53.                 default:
  54.                     {
  55.                         if (instrument == "ribbon")
  56.                         {
  57.                             difficulty = 9.2M;
  58.                             performance = 9.5M;
  59.                         }
  60.                         else if (instrument == "hoop")
  61.                         {
  62.                             difficulty = 9.450M;
  63.                             performance = 9.350M;
  64.                         }
  65.                         else
  66.                         {
  67.                             difficulty = 9.7M;
  68.                             performance = 9.150M;
  69.                         }
  70.                         break;
  71.                     }
  72.  
  73.             }
  74.             decimal grade = difficulty + performance;
  75.             decimal leftPts = 20 - grade;
  76.             decimal percent = leftPts / 20 * 100;
  77.             Console.WriteLine($"The team of {country} get {grade:f3} on {instrument}.");
  78.             Console.WriteLine($"{percent:f2}%");
  79.         }
  80.     }
  81.    
  82. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement