Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace exampreparation
- {
- class exam
- {
- static void Main(string[] args)
- {
- string name = Console.ReadLine();
- int playedGames = int.Parse(Console.ReadLine());
- int volleyCount = 0;
- int tennisCount = 0;
- int badmintonCount = 0;
- double pointsVolley = 0.0;
- double pointsTennis = 0.0;
- double pointsBadminton = 0.0;
- for (int i = 1; i <= playedGames; i++)
- {
- string gameName = Console.ReadLine();
- int points = int.Parse(Console.ReadLine());
- if (gameName == "volleyball")
- {
- pointsVolley += points * 1.07;
- volleyCount++;
- }
- else if (gameName == "tennis")
- {
- pointsTennis += points * 1.05;
- tennisCount++;
- }
- else
- {
- pointsBadminton += points * 1.02;
- badmintonCount++;
- }
- }
- double averageVolley = pointsVolley / volleyCount;
- double averageTennis = pointsTennis / tennisCount;
- double averageBadminton = pointsBadminton / badmintonCount;
- double full = pointsBadminton + pointsTennis + pointsVolley;
- if (averageBadminton >= 75 && averageTennis >= 75 && averageVolley >= 75)
- {
- Console.WriteLine($"Congratulations, {name}! You won the cruise games with {Math.Floor(full)} points.");
- }
- else
- {
- Console.WriteLine($"Sorry, {name}, you lost. Your points are only {Math.Floor(full)}.");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement