Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace _05._Cruise_Games
- {
- class Program
- {
- static void Main(string[] args)
- {
- double counterVolleyball = 0;
- double counterTennis = 0;
- double counterBadminton = 0;
- double pointsCountVolleyball = 0;
- double pointsCountTennis = 0;
- double pointsCountBadminton = 0;
- double pointsCountVolleyballTotal = 0;
- double pointsCountTennisTotal = 0;
- double pointsCountBadmintonTotal = 0;
- string namePlayer = Console.ReadLine();
- double gamesPlayed = double.Parse(Console.ReadLine());
- for (int i = 0; i < gamesPlayed; i++)
- {
- string nameGame = Console.ReadLine();
- double pointsCount = double.Parse(Console.ReadLine());
- switch (nameGame)
- {
- case "volleyball":
- pointsCountVolleyball = 1.07 * pointsCount;
- pointsCountVolleyballTotal += pointsCountVolleyball;
- counterVolleyball++;
- break;
- case "tennis":
- pointsCountTennis = 1.05 * pointsCount;
- pointsCountTennisTotal += pointsCountTennis;
- counterTennis++;
- break;
- case "badminton":
- pointsCountBadminton = 1.02 * pointsCount;
- pointsCountBadmintonTotal += pointsCountBadminton;
- counterBadminton++;
- break;
- }
- }
- if ((pointsCountVolleyballTotal / counterVolleyball) >= 75)
- {
- if ((pointsCountTennisTotal / counterTennis) >= 75)
- {
- if ((pointsCountBadmintonTotal / counterBadminton) >= 75)
- {
- Console.WriteLine($"Congratulations, {namePlayer}! You won the cruise games with {Math.Floor(pointsCountVolleyballTotal + pointsCountTennisTotal + pointsCountBadmintonTotal)} points.");
- }
- }
- }
- else
- {
- Console.WriteLine($"Sorry, {namePlayer}, you lost. Your points are only {Math.Floor(pointsCountVolleyballTotal + pointsCountTennisTotal + pointsCountBadmintonTotal)}.");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement