Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- class Program
- {
- public static void Main(string[] args)
- {
- string product = Console.ReadLine();
- double quantity = double.Parse(Console.ReadLine());
- double result= Money(product, quantity);
- Console.WriteLine($"{result:f2}");
- }
- public static double Money(string st,double d)
- {
- double totalprice = 0.00;
- if (st == "coffee")
- {
- totalprice= d * 1.50;
- }
- else if (st == "coke")
- {
- totalprice= d * 1.40;
- }
- else if(st=="water")
- {
- totalprice= d * 1.00;
- }
- else if(st== "snacks")
- {
- totalprice = d * 2.00;
- }
- return totalprice;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement