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