Advertisement
Niicksana

Santas Holiday

Jan 2nd, 2018
259
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.94 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace _3.Santas_Holiday
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             // Programming Basics Exam - 16 December 2017
  14.             int days = int.Parse(Console.ReadLine());
  15.             string roomType = Console.ReadLine();
  16.             string review = Console.ReadLine();
  17.  
  18.             double percentage = 1;
  19.             double price;
  20.             if (roomType == "apartment")
  21.             {
  22.                 price = (days - 1) * 25.00;
  23.  
  24.                 if (days < 10)
  25.                 {
  26.                     percentage *= 0.70;
  27.                 }
  28.  
  29.                 else if (days >= 10 && days <= 15)
  30.                 {
  31.                     percentage *= 0.65;
  32.                 }
  33.  
  34.                 else
  35.                 {
  36.                     percentage *= 0.50;
  37.                 }
  38.             }
  39.  
  40.             else if (roomType == "president apartment")
  41.             {
  42.                 price = (days - 1) * 35.00;
  43.  
  44.                 if (days < 10)
  45.                 {
  46.                     percentage *= 0.90;
  47.                 }
  48.  
  49.                 else if (days >= 10 && days <= 15)
  50.                 {
  51.                     percentage *= 0.85;
  52.                 }
  53.  
  54.                 else
  55.                 {
  56.                     percentage *= 0.80;
  57.                 }
  58.             }
  59.  
  60.             else
  61.             {
  62.                 price = (days - 1) * 18.00;
  63.                 percentage *= 1.00;
  64.             }
  65.  
  66.             double perPrice = price * percentage;
  67.             double totalPrice;
  68.  
  69.             if (review == "positive")
  70.             {
  71.                 totalPrice = perPrice + (perPrice * 0.25);
  72.             }
  73.  
  74.             else
  75.             {
  76.                 totalPrice = perPrice - (perPrice * 0.10);
  77.             }
  78.  
  79.             Console.WriteLine("{0:f2}", totalPrice);
  80.         }
  81.     }
  82. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement