SHARE
TWEET

Untitled

a guest Jan 15th, 2020 65 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. using System;
  2.  
  3. namespace _05._Cruise_Games
  4. {
  5.     class Program
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.             double counterVolleyball = 0;
  10.             double counterTennis = 0;
  11.             double counterBadminton = 0;
  12.  
  13.             double pointsCountVolleyball = 0;
  14.             double pointsCountTennis = 0;
  15.             double pointsCountBadminton = 0;
  16.  
  17.             double pointsCountVolleyballTotal = 0;
  18.             double pointsCountTennisTotal = 0;
  19.             double pointsCountBadmintonTotal = 0;
  20.  
  21.             string namePlayer = Console.ReadLine();
  22.             double gamesPlayed = double.Parse(Console.ReadLine());
  23.  
  24.             for (int i = 0; i < gamesPlayed; i++)
  25.             {
  26.                 string nameGame = Console.ReadLine();
  27.                 double pointsCount = double.Parse(Console.ReadLine());
  28.  
  29.                 switch (nameGame)
  30.                 {
  31.                     case "volleyball":
  32.                         pointsCountVolleyball = 1.07 * pointsCount;
  33.                         pointsCountVolleyballTotal += pointsCountVolleyball;
  34.                         counterVolleyball++;
  35.                         break;
  36.                     case "tennis":
  37.                         pointsCountTennis = 1.05 * pointsCount;
  38.                         pointsCountTennisTotal += pointsCountTennis;
  39.                         counterTennis++;
  40.                         break;
  41.                     case "badminton":
  42.                         pointsCountBadminton = 1.02 * pointsCount;
  43.                         pointsCountBadmintonTotal += pointsCountBadminton;
  44.                         counterBadminton++;
  45.                         break;
  46.                 }
  47.             }
  48.  
  49.             if ((pointsCountVolleyballTotal / counterVolleyball) >= 75)
  50.             {
  51.                 if ((pointsCountTennisTotal / counterTennis) >= 75)
  52.                 {
  53.                     if ((pointsCountBadmintonTotal / counterBadminton) >= 75)
  54.                     {
  55.                         Console.WriteLine($"Congratulations, {namePlayer}! You won the cruise games with {Math.Floor(pointsCountVolleyballTotal + pointsCountTennisTotal + pointsCountBadmintonTotal)} points.");
  56.                     }
  57.                 }
  58.             }
  59.             else
  60.             {
  61.                 Console.WriteLine($"Sorry, {namePlayer}, you lost. Your points are only {Math.Floor(pointsCountVolleyballTotal + pointsCountTennisTotal + pointsCountBadmintonTotal)}.");
  62.             }
  63.         }
  64.     }
  65. }
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