Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace _05._Orders
- {
- class Program
- {
- static void Main(string[] args)
- {
- string product = Console.ReadLine();
- int quantityProduct = int.Parse(Console.ReadLine());
- CalculatesTotaPriceOrder(product, quantityProduct);
- }
- static void CalculatesTotaPriceOrder(string product,int quantityProduct)
- {
- double priceProduct = 0;
- switch(product)
- {
- case "coffee":
- priceProduct = 1.50;
- break;
- case "coke":
- priceProduct = 1.40;
- break;
- case "water":
- priceProduct = 1.00;
- break;
- case "snacks":
- priceProduct = 2.00;
- break;
- }
- double totalPrice = quantityProduct * priceProduct;
- Console.WriteLine($"{totalPrice:f2}");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment