Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace Demo
- {
- class Program
- {
- static void Main(string[] args)
- {
- //Write a program, which receives a profession (as a string) and chooses the perfect drink for the person.Your program
- //needs to get smarter. Now you will receive on the second line the quantities of the drink and you have to print the
- //calculated the price.
- string profession = Console.ReadLine();
- int quantity = int.Parse(Console.ReadLine());
- double price = 0;
- double water = 0.70;
- double coffee = 1.00;
- double beer = 1.70;
- double tea = 1.20;
- if (profession == "Athlete")
- {
- price = quantity * water;
- }
- else if (profession == "Businessman" || profession == "Businesswoman")
- {
- price = quantity * coffee;
- }
- else if (profession == "SoftUni Student")
- {
- price = quantity * beer;
- }
- else
- {
- price = quantity * tea;
- }
- Console.WriteLine($"The {profession} has to pay {price:f2}.");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment