Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace SmallShop
- {
- class Program
- {
- static void Main(string[] args)
- {
- //Напишете програма, която чете град(низ), продукт(низ) и количество(десетично число),
- //въведени от потребителя, и пресмята и отпечатва колко струва съответното количество
- //от избрания продукт в посочения град.
- string product = Console.ReadLine().ToLower();
- string town = Console.ReadLine();
- double quantity = double.Parse(Console.ReadLine());
- double price = -1.0;
- if (town == "Sofia")
- {
- if (product == "coffee")
- {
- price = 0.50 * quantity;
- }
- else if (product == "water")
- {
- price = 0.80 * quantity;
- }
- else if (product == "beer")
- {
- price = 1.20 * quantity;
- }
- else if (product == "sweets")
- {
- price = 1.45 * quantity;
- }
- else if (product == "peanuts")
- {
- price = 1.60 * quantity;
- }
- }
- else if (town == "Plovdiv")
- {
- if (product == "coffee")
- {
- price = 0.40 * quantity;
- }
- else if (product == "water")
- {
- price = 0.70 * quantity;
- }
- else if (product == "beer")
- {
- price = 1.15 * quantity;
- }
- else if (product == "sweets")
- {
- price = 1.30 * quantity;
- }
- else if (product == "peanuts")
- {
- price = 1.50 * quantity;
- }
- }
- else if (town == "Varna")
- {
- if (product == "coffee")
- {
- price = 0.45 * quantity;
- }
- else if (product == "water")
- {
- price = 0.70 * quantity;
- }
- else if (product == "beer")
- {
- price = 1.10 * quantity;
- }
- else if (product == "sweets")
- {
- price = 1.35 * quantity;
- }
- else if (product == "peanuts")
- {
- price = 1.55 * quantity;
- }
- }
- if (price > 0)
- {
- Console.WriteLine(price);
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment