Advertisement
Qrist

Untitled

Apr 15th, 2020
208
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.78 KB | None | 0 0
  1. using System;
  2.  
  3. class Program
  4. {
  5.     public static void Main(string[] args)
  6.     {
  7.         string product = Console.ReadLine();
  8.         double quantity = double.Parse(Console.ReadLine());
  9.         double result= Money(product, quantity);
  10.         Console.WriteLine($"{result:f2}");
  11.     }
  12.     public static double Money(string st,double d)
  13.     {
  14.         double totalprice = 0.00;
  15.         if (st == "coffee")
  16.         {
  17.             totalprice= d * 1.50;
  18.         }
  19.         else if (st == "coke")
  20.         {
  21.            totalprice= d * 1.40;
  22.         }
  23.         else if(st=="water")
  24.         {
  25.           totalprice= d * 1.00;
  26.         }
  27.         else if(st== "snacks")
  28.         {
  29.            totalprice = d * 2.00;
  30.         }
  31.         return totalprice;
  32.     }
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement