Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- string typeOfProjection = Console.ReadLine();
- int lineAmmount = int.Parse(Console.ReadLine());
- int columnsAmmount = int.Parse(Console.ReadLine());
- double result = 0.00;
- // Here we resolved the task with the if else statement
- if (typeOfProjection == "Premiere")
- {
- double premierePrice = 12.00;
- result = lineAmmount * columnsAmmount * premierePrice;
- }
- else if (typeOfProjection == "Normal")
- {
- double normalPrice = 7.50;
- result = lineAmmount * columnsAmmount * normalPrice;
- }
- else if (typeOfProjection == "Discount")
- {
- double discountPrice = 5.00;
- result = lineAmmount * columnsAmmount * discountPrice;
- }
- Console.WriteLine($"{result:F2} leva");
- //Here we resolved the task with the switch case statement
- switch (typeOfProjection)
- {
- case "Premiere":
- double premierePrice = 12.00;
- result = lineAmmount * columnsAmmount * premierePrice;
- break;
- case "Normal":
- double normalPrice = 7.50;
- result = lineAmmount * columnsAmmount * normalPrice;
- break;
- case "Discount":
- double discountPrice = 5.00;
- result = lineAmmount * columnsAmmount * discountPrice;
- break;
- }
- Console.WriteLine($"{result:F2} leva");
Advertisement
Comments
-
- .NET 6
-
- Here we solved the task with two different types of solutions. The one is the if-else statement and the other is the switch-case statement!
Add Comment
Please, Sign In to add comment
Advertisement