Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace ConsoleApp1
- {
- class Program
- {
- static void Main(string[] args)
- {
- string namePlayer = Console.ReadLine();
- int countGames = int.Parse(Console.ReadLine());
- double tempPointVolley = 0;
- double tempPointTenis = 0;
- double tempPointBadminton = 0;
- double sumGameVoley = 0;
- double sumGameTenis = 0;
- double sumGameBadm = 0;
- for (int i = 0; i < countGames; i++)
- {
- string nameGame = Console.ReadLine();
- double countPoints = double.Parse(Console.ReadLine());
- if (nameGame == "volleyball")
- {
- tempPointVolley = countPoints * 1.07;
- sumGameVoley += tempPointVolley;
- }
- else if (nameGame == "tennis")
- {
- tempPointTenis = countPoints * 1.05;
- sumGameTenis += tempPointTenis;
- }
- else if (nameGame == "badminton")
- {
- tempPointBadminton = countPoints * 1.02;
- sumGameBadm += tempPointBadminton;
- }
- }
- double sumPoint = Math.Floor(sumGameVoley + sumGameTenis + sumGameBadm);
- double srednoaritmeticno = Math.Floor(sumPoint / countGames);
- if (srednoaritmeticno >= 75)
- {
- Console.WriteLine($"Congratulations, {namePlayer}! You won the cruise games with {sumPoint} points.");
- }
- else
- {
- Console.WriteLine($"Sorry, {namePlayer}, you lost. Your points are only {sumPoint}.");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment