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 NewProject
- {
- class Program
- {
- static void Main(string[] args)
- {
- double balance = double.Parse(Console.ReadLine());
- double currentMoney = balance;
- var input = Console.ReadLine();
- while (input != "Game Time" && currentMoney != 0)
- {
- switch (input)
- {
- case "OutFall 4":
- if (currentMoney < 39.99)
- {
- Console.WriteLine("Too Expensive");
- break;
- }
- currentMoney -= 39.99;
- Console.WriteLine("Bought OutFall 4");
- break;
- case "CS: OG":
- if (currentMoney < 15.99)
- {
- Console.WriteLine("Too Expensive");
- break;
- }
- currentMoney -= 15.99;
- Console.WriteLine("Bought CS: OG");
- break;
- case "Zplinter Zell":
- if (currentMoney < 19.99)
- {
- Console.WriteLine("Too Expensive");
- break;
- }
- currentMoney -= 19.99;
- Console.WriteLine("Bought Zplinter Zell");
- break;
- case "Honored 2":
- if (currentMoney < 59.99)
- {
- Console.WriteLine("Too Expensive");
- break;
- }
- currentMoney -= 59.99;
- Console.WriteLine("Bought Honored 2");
- break;
- case "RoverWatch":
- if (currentMoney < 29.99)
- {
- Console.WriteLine("Too Expensive");
- break;
- }
- currentMoney -= 29.99;
- Console.WriteLine("Bought RoverWatch");
- break;
- case "RoverWatch Origins Edition":
- if (currentMoney < 39.99)
- {
- Console.WriteLine("Too Expensive");
- break;
- }
- currentMoney -= 39.99;
- Console.WriteLine("Bought RoverWatch Origins Edition");
- break;
- default:
- Console.WriteLine("Not Found");
- break;
- }
- input = Console.ReadLine();
- }
- if (currentMoney == 0)
- {
- Console.WriteLine("Out of money!");
- }
- else
- {
- var moneySpend = balance - currentMoney;
- Console.WriteLine("Total spent: ${0:F2}. Remaining: ${1:F2}", moneySpend, currentMoney);
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment