Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace exampreparation
- {
- class exam
- {
- static void Main(string[] args)
- {
- int budget = int.Parse(Console.ReadLine());
- char sex = char.Parse(Console.ReadLine());
- int age = int.Parse(Console.ReadLine());
- string sport = Console.ReadLine();
- double price = 0.0;
- if (sex == 'm')
- {
- if (sport == "Gym")
- {
- price = 42;
- }
- else if (sport == "Boxing")
- {
- price = 41;
- }
- else if (sport == "Yoga")
- {
- price = 45;
- }
- else if (sport == "Zumba")
- {
- price = 34;
- }
- else if (sport == "Dances")
- {
- price = 51;
- }
- else
- {
- price = 39;
- }
- }
- else
- {
- if (sport == "Gym")
- {
- price = 35;
- }
- else if (sport == "Boxing")
- {
- price = 37;
- }
- else if (sport == "Yoga")
- {
- price = 42;
- }
- else if (sport == "Zumba")
- {
- price = 31;
- }
- else if (sport == "Dances")
- {
- price = 53;
- }
- else
- {
- price = 37;
- }
- }
- if (age <= 19)
- {
- price *= 0.80;
- }
- if (price <= budget)
- {
- Console.WriteLine($"You purchased a 1 month pass for {sport}.");
- }
- else
- {
- Console.WriteLine($"You don't have enough money! You need ${price-budget:F2} more.");
- }
- }
- }
- }
Add Comment
Please, Sign In to add comment