Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace ComputerStore
- {
- class Program
- {
- static void Main(string[] args)
- {
- double totalPrice = 0, price;
- string command = Console.ReadLine();
- while (command != "special" && command != "regular")
- {
- price = double.Parse(command);
- if (price > 0)
- {
- totalPrice += price;
- }
- else
- {
- Console.WriteLine("Invalid price!");
- }
- command = Console.ReadLine();
- }
- if (totalPrice == 0)
- {
- Console.WriteLine("Invalid order!");
- }
- else
- {
- Console.WriteLine(
- $"Congratulations you've just bought a new computer!\n" +
- $"Price without taxes: {totalPrice:f2}$\n" +
- $"Taxes: {totalPrice / 5:f2}$\n" +
- $"-----------\n" +
- $"Total price: {totalPrice * 1.2 * (command == "special" ? 0.9 : 1):f2}$"
- );
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement