Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Linq;
- namespace Methods
- {
- public class Methods
- {
- public static void Main()
- {
- string products = Console.ReadLine();
- int quantity = int.Parse(Console.ReadLine());
- TotalPrice(products, quantity);
- }
- public static void TotalPrice(string products, int quantity)
- {
- double price = 0;
- switch (products)
- {
- case "coffee":
- price = 1.50 * quantity;
- Console.WriteLine($"{price:f2}");
- break;
- case "water":
- price = 1.00 * quantity;
- Console.WriteLine($"{price:f2}");
- break;
- case "coke":
- price = 1.40 * quantity;
- Console.WriteLine($"{price:f2}");
- break;
- case "snacks":
- price = 2.00 * quantity;
- Console.WriteLine($"{price:f2}");
- break;
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement