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.Numerics;
- using System.Text;
- using System.Text.RegularExpressions;
- using System.Threading.Tasks;
- namespace ExamPreparation
- {
- class Program
- {
- static void Main(string[] args)
- {
- double currentBalance = double.Parse(Console.ReadLine());
- string[] games = new string[] { "OutFall 4", "CS: OG", "Zplinter Zell", "Honored 2", "RoverWatch", "RoverWatch Origins Edition" };
- double spentMoney = 0;
- while (true)
- {
- string input = Console.ReadLine();
- if (currentBalance <= 0)
- {
- Console.WriteLine("Out of money!");
- return;
- }
- if (input == "Game Time")
- {
- Console.WriteLine($"Total spent: ${spentMoney:F2}. Remaining: ${currentBalance:F2}");
- break;
- }
- if (!games.Contains(input))
- {
- Console.WriteLine("Not Found");
- continue;
- }
- if (input == games[0])
- {
- if (currentBalance - 39.99 < 0)
- {
- Console.WriteLine("Too Expensive");
- continue;
- }
- currentBalance -= 39.99;
- spentMoney += 39.99;
- Console.WriteLine("Bought OutFall 4");
- }
- else if (input == games[1])
- {
- if (currentBalance - 15.99 < 0)
- {
- Console.WriteLine("Too Expensive");
- continue;
- }
- currentBalance -= 15.99;
- spentMoney += 15.99;
- Console.WriteLine("Bought CS: OG");
- }
- else if (input == games[2])
- {
- if (currentBalance - 19.99 < 0)
- {
- Console.WriteLine("Too Expensive");
- continue;
- }
- currentBalance -= 19.99;
- spentMoney += 19.99;
- Console.WriteLine("Bought Zplinter Zell");
- }
- else if (input == games[3])
- {
- if (currentBalance - 59.99 < 0)
- {
- Console.WriteLine("Too Expensive");
- continue;
- }
- currentBalance -= 59.99;
- spentMoney += 59.99;
- Console.WriteLine("Bought Honored 2");
- }
- else if (input == games[4])
- {
- if (currentBalance - 29.99 < 0)
- {
- Console.WriteLine("Too Expensive");
- continue;
- }
- currentBalance -= 29.99;
- spentMoney += 29.99;
- Console.WriteLine("Bought RoverWatch");
- }
- else if (input == games[5])
- {
- if (currentBalance - 39.99 < 0)
- {
- Console.WriteLine("Too Expensive");
- continue;
- }
- currentBalance -= 39.99;
- spentMoney += 39.99;
- Console.WriteLine("Bought RoverWatch Origins Edition");
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement