Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace P10_RageExprenses
- {
- class Program
- {
- static void Main(string[] args)
- {
- double balance = double.Parse(Console.ReadLine());
- double price = 0;
- double currentBalance = balance;
- string game = Console.ReadLine();
- while (game != "Game Time")
- {
- switch (game)
- {
- case "OutFall 4": price = 39.99; break;
- case "CS: OG": price = 15.99; break;
- case "Zplinter Zell": price = 19.99; break;
- case "Honored 2": price = 59.99; break;
- case "RoverWatch": price = 29.99; break;
- case "RoverWatch Origins Edition": price = 39.99; break;
- default:
- Console.WriteLine("Not Found");
- break;
- }
- balance -= price;
- if (balance == 0)
- {
- Console.WriteLine("Out of money!");
- return;
- }
- if (price <= balance)
- {
- Console.WriteLine($"Bought {game}");
- }
- else
- {
- Console.WriteLine("Too Expensive");
- }
- game = Console.ReadLine();
- }
- Console.WriteLine($"Total spent: ${currentBalance-balance:f2}. Remaining: ${balance:f2}");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement