Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace _26._06._2017
- {
- class Program
- {
- static void Main(string[] args)
- {
- double balance = double.Parse(Console.ReadLine());
- double balance1 = balance;
- double spent = 0;
- double remaining = 0;
- double gamePrice = 0.0;
- string game;
- for (int i = 0; ; i++)
- {
- game = Console.ReadLine();
- if (balance <= 0)
- { Console.WriteLine("Out Of money"); break; }
- if (game != "Game Time")
- {
- if (game == "OutFall 4")
- {
- gamePrice = 39.99;
- }
- else if (game == "CS: OG")
- {
- gamePrice = 15.99;
- }
- else if (game == "Zplinter Zell")
- { gamePrice += 19.99; }
- else if (game == "Honored 2")
- { gamePrice += 59.99; }
- else if (game == "RoverWatch")
- { gamePrice += 29.99; }
- else if (game == "RoverWatch Origins Edition")
- { gamePrice += 39.99; }
- else
- {
- Console.WriteLine("Not Found");
- continue;
- }
- if (balance < gamePrice)
- {
- Console.WriteLine("Too Expensive");continue;
- }
- else
- {
- balance1 -= gamePrice;
- Console.WriteLine("Bought " + game);
- }
- }
- else
- {
- Console.Write("Total spent: $");
- Console.Write("{0:F2}", gamePrice);
- Console.Write(". Remaining: $");
- Console.WriteLine("{0:f2}", balance - gamePrice); break;
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement