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