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 Vacation
- {
- class Program
- {
- static void Main(string[] args)
- {
- // • Първият ред – броят възрастни хора.Цяло число в интервала[1…100]
- //• Вторият ред – броят ученици. Цяло число в интервала[1… 100]
- //• Третият ред – броят нощувки. Цяло число в интервала[1... 60]
- //• Четвъртият ред – вид транспорт – “train”, “bus”, “boat” или “airplane”
- int oldPeopleCount = int.Parse(Console.ReadLine());
- int studentsCount = int.Parse(Console.ReadLine());
- int sleepovers = int.Parse(Console.ReadLine());
- string transportType = Console.ReadLine().ToLower();
- double oldPeopleTransportCosts = 0.0;
- double studentsTransportCosts = 0.0;
- if (transportType == "train")
- {
- oldPeopleTransportCosts = oldPeopleCount * 24.99;
- studentsTransportCosts = studentsCount * 14.99;
- if (oldPeopleCount + studentsCount >= 50)
- {
- oldPeopleTransportCosts *= 0.5;
- studentsTransportCosts *= 0.5;
- }
- }
- else if (transportType == "bus")
- {
- oldPeopleTransportCosts = oldPeopleCount * 32.50;
- studentsTransportCosts = studentsCount * 28.50;
- }
- else if (transportType == "boat")
- {
- oldPeopleTransportCosts = oldPeopleCount * 42.99;
- studentsTransportCosts = studentsCount * 39.99;
- }
- else if (transportType == "airplane")
- {
- oldPeopleTransportCosts = oldPeopleCount * 70.0;
- studentsTransportCosts = studentsCount * 50.0;
- }
- double totalTransportCosts = (oldPeopleTransportCosts + studentsTransportCosts) * 2.0;
- double totalSleepoverCosts = sleepovers * 82.99;
- double totalCostsWithoutComission = totalTransportCosts + totalSleepoverCosts;
- double comission = totalCostsWithoutComission * 0.1;
- double totalCosts = totalCostsWithoutComission + comission;
- Console.WriteLine($"{totalCosts:f2}");
- }
- }
- }
Add Comment
Please, Sign In to add comment