kirililchev3

Choose a drink 2.0 - if else

May 19th, 2018
286
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.27 KB | None | 0 0
  1. using System;
  2.  
  3. namespace Exercise2
  4. {
  5.     class Program
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.             string profession = Console.ReadLine();
  10.             int quantity = int.Parse(Console.ReadLine());
  11.              
  12.             if (profession == "Athlete")
  13.             {
  14.                double price = 0.70;
  15.                double totalPrice = quantity * price;
  16.                Console.WriteLine($"The {profession} has to pay {totalPrice:f2}.");
  17.                
  18.                
  19.             } else if (profession == "Businessman" || profession == "Businesswoman")
  20.             {
  21.                 double price = 1.00;
  22.                 double totalPrice = quantity * price;
  23.                 Console.WriteLine($"The {profession} has to pay {totalPrice:f2}.");
  24.  
  25.             } else if (profession == "SoftUni Student")
  26.             {
  27.                 double price = 1.70;
  28.                 double totalPrice = quantity * price;
  29.                 Console.WriteLine($"The {profession} has to pay {totalPrice:f2}.");
  30.  
  31.             } else
  32.             {
  33.                 double price = 1.20;
  34.                 double totalPrice = quantity * price;
  35.                 Console.WriteLine($"The {profession} has to pay {totalPrice:f2}.");
  36.             }
  37.         }
  38.     }
  39. }
Advertisement
Add Comment
Please, Sign In to add comment