Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace CruiseGames
- {
- class Program
- {
- static void Main(string[] args)
- {
- string gamer = Console.ReadLine();
- int games = int.Parse(Console.ReadLine());
- int volleyballGames = 0;
- double volleyballScores = 0;
- int tennisGames = 0;
- double tennisScores = 0;
- int badmintonGames = 0;
- double badmintonScores = 0;
- for (int i = 0; i < games; i++)
- {
- string game = Console.ReadLine();
- int score = int.Parse(Console.ReadLine());
- if (game == "volleyball")
- {
- volleyballGames++;
- volleyballScores += score * 1.07;
- }
- else if (game == "tennis")
- {
- tennisGames++;
- tennisScores += score * 1.05;
- }
- else
- {
- badmintonGames++;
- badmintonScores += score * 1.02;
- }
- }
- int averageVolleyballPoints = (int)(volleyballScores / volleyballGames);
- int averageTennisPoints = (int)(tennisScores / tennisGames);
- int averageBadmintonPoints = (int)(badmintonScores / badmintonGames);
- int totalPoints = (int)(volleyballScores + tennisScores + badmintonScores);
- if(averageVolleyballPoints >= 75 && averageTennisPoints >= 75 && averageBadmintonPoints >= 75)
- {
- Console.WriteLine($"Congratulations, {gamer}! You won the cruise games with {totalPoints} points.");
- }
- else
- {
- Console.WriteLine($"Sorry, {gamer}, you lost. Your points are only {totalPoints}.");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement