Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- namespace ConsoleApp6
- {
- class Program
- {
- static void Main(string[] args)
- {
- string playerName = Console.ReadLine();
- int gamesCount = int.Parse(Console.ReadLine());
- int volleyCnt = 0, tenisCnt = 0, badmCnt = 0;
- double volleyScore = 0.0;
- double tennisScore = 0.0;
- double badminScore = 0.0;
- for(int i = 0; i < gamesCount; i++)
- {
- string gameName = Console.ReadLine();
- int points = int.Parse(Console.ReadLine());
- if(gameName == "volleyball")
- {
- volleyScore += points + (0.07 * points);
- volleyCnt++;
- }
- else if(gameName == "tennis")
- {
- tennisScore += points + (0.05 * points);
- tenisCnt++;
- }
- else if (gameName == "badminton")
- {
- badminScore += points + (0.02 * points);
- badmCnt++;
- }
- }
- double avg = 0;
- double total = Math.Floor(volleyScore + tennisScore + badminScore);
- avg = Math.Floor(total / (badmCnt + volleyCnt + tenisCnt));
- if(avg >= 75)
- {
- Console.WriteLine($"Congratulations, {playerName}! You won the cruise games with {total} points.");
- }
- else
- {
- Console.WriteLine($"Sorry, {playerName}, you lost. Your points are only {total}.");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement