Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace ConsoleApp138
- {
- class Program
- {
- static void Main(string[] args)
- {
- double balance = double.Parse(Console.ReadLine());
- double price = 0;
- double leftMoney = 0;
- double sum = 0;
- while (true)
- {
- string game = Console.ReadLine();
- if (game == "Game Time")
- {
- break;
- }
- if (game == "OutFall4" && game == "RoverWatchOriginsEdition")
- {
- price = 39.99;
- sum += price;
- }
- else if (game == "CS:OG")
- {
- price = 15.99;
- sum += price;
- }
- else if (game == "ZplinterZell")
- {
- price = 19.99;
- sum += price;
- }
- else if (game == "Honored2")
- {
- price = 59.99;
- sum += price;
- }
- else if (game == "RoverWatch")
- {
- price = 29.99;
- sum += price;
- }
- else if (game != "RoverWatch" || game != "Honored2" || game != "ZplinterZell" || game != "CS:OG" || game != "OutFall4" ||
- game != "RoverWatchOriginsEdition")
- {
- Console.WriteLine("Not Found");
- }
- else
- {
- Console.WriteLine("Bought {0}", game);
- balance -= price;
- }
- leftMoney = balance -price;
- if (leftMoney < 0)
- {
- Console.WriteLine("Out of money!");
- return;
- }
- if (leftMoney < price)
- {
- Console.WriteLine("Too Expensive");
- }
- }
- Console.WriteLine("Total spent: ${0:f2}. Remaining: ${1:f2}.", sum, leftMoney);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement