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 lab_18_hotelRoom
- {
- class Program
- {
- static void Main(string[] args)
- {
- // data input
- var month = Console.ReadLine().ToLower();
- var nights = int.Parse(Console.ReadLine());
- // variables
- decimal appPrice = 0.0M;
- decimal stuPrice = 0.0M;
- decimal stu14Days = 1M;
- decimal stu7Days = 1M;
- decimal app14Days = 1M - 0.10M;
- string output = string.Empty;
- // calculate price and discount based on months
- switch (month)
- {
- case "may":
- case "october":
- appPrice = 65.00M;
- stuPrice = 50.00M;
- stu7Days = 1M - 0.05M;
- stu14Days = 1M - 0.30M;
- break;
- case "june":
- case "september":
- appPrice = 68.70M;
- stuPrice = 75.20M;
- stu14Days = 1M - 0.20M;
- break;
- case "july":
- case "august":
- appPrice = 77.00M;
- stuPrice = 76.00M;
- break;
- }
- // calculate total price depending on number of nights
- if (nights > 14)
- {
- appPrice *= app14Days;
- stuPrice *= stu14Days;
- }
- else if (nights > 7)
- {
- stuPrice *= stu7Days;
- }
- output = string.Format("Apartment: {0:F2} lv. \nStudio: {1:F2} lv.",
- appPrice * nights, stuPrice * nights);
- Console.WriteLine(output);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment