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