Advertisement
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 exam
- {
- class Program
- {
- static void Main(string[] args)
- {
- int days = int.Parse(Console.ReadLine());
- string room = Console.ReadLine();
- string grade = Console.ReadLine();
- double roomOne = 18.00;
- double apartment = 25.00;
- double president = 35.00;
- double discount = 0;
- double all = 0;
- int nights = days - 1;
- if (room== "room for one person")
- {
- if ((days < 10) || (days >= 10 && days <= 15) || (days > 15))
- {
- discount = nights * roomOne;
- }
- }
- if (room == "apartment")
- {
- if (days<10)
- {
- double priceNights = nights * apartment;
- discount = priceNights * 0.7;
- }
- else if (days>=10 && days<=15)
- {
- double priceNights = nights * apartment;
- double discount2 = priceNights * 0.35;
- discount = priceNights - discount2;
- }
- else if (days>15)
- {
- double priceNights = nights * apartment;
- double discount2 = priceNights * 0.5;
- discount = priceNights -discount2;
- }
- }
- if (room == "president apartment")
- {
- if (days < 10)
- {
- double priceNights = nights * president;
- double discount2 = priceNights * 0.9;
- discount = priceNights - discount2;
- }
- else if (days >= 10 && days <= 15)
- {
- double priceNights = nights * president;
- double discount2 = priceNights * 0.85;
- discount = priceNights - discount2;
- }
- else if (days > 15)
- {
- double priceNights = nights * president;
- double discount2 = priceNights * 0.2;
- discount = priceNights - discount2;
- }
- }
- if (grade == "positive")
- {
- all = discount + (discount * 0.25);
- }
- else if (grade == "negative")
- {
- all = discount - (discount * 0.10);
- }
- Console.WriteLine("{0:F2}",all);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement