Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace Vacation
- {
- class Program
- {
- static void Main(string[] args)
- {
- int seniorsCount = int.Parse(Console.ReadLine());
- int studentsCount = int.Parse(Console.ReadLine());
- int sleepoversCount = int.Parse(Console.ReadLine());
- string transport = Console.ReadLine();
- double ticketCostForSenior = 32.5;
- double ticketCostForStudent = 28.5;
- if (transport == "train")
- {
- ticketCostForSenior = 24.99;
- ticketCostForStudent = 14.99;
- if (seniorsCount + studentsCount >= 50)
- {
- ticketCostForSenior *= 0.5;
- ticketCostForStudent *= 0.5;
- }
- }
- else if (transport == "boat")
- {
- ticketCostForSenior = 42.99;
- ticketCostForStudent = 39.99;
- }
- else if (transport == "airplane")
- {
- ticketCostForSenior = 70.0;
- ticketCostForStudent = 50.0;
- }
- double totalCostForTicket = ((ticketCostForSenior * seniorsCount) +
- (ticketCostForStudent * studentsCount)) *
- 2;
- double costForSleepovers = sleepoversCount * 82.99;
- double totalCost = (totalCostForTicket + costForSleepovers) * 1.1;
- Console.WriteLine($"{totalCost:f2}");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement