Advertisement
Guest User

Untitled

a guest
Nov 4th, 2018
220
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.90 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 test3
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             int budget = int.Parse(Console.ReadLine());
  14.                 string season = Console.ReadLine();
  15.                 int numFishermen = int.Parse(Console.ReadLine());
  16.                 double rentalPrice = 0;
  17.  
  18.  
  19.                 switch (season)
  20.                 {
  21.                     case "Spring":
  22.                         rentalPrice = 3000;
  23.                         break;
  24.                     case "Summer":
  25.                         rentalPrice = 4200;
  26.                         break;
  27.                     case "Autumn":
  28.                         rentalPrice = 4200;
  29.                         break;
  30.                     case "Winter":
  31.                         rentalPrice = 2600;
  32.                         break;
  33.                 }
  34.                 if (numFishermen <= 6)
  35.                 {
  36.                     rentalPrice = rentalPrice - (rentalPrice * 0.10);
  37.                 }
  38.                 else if (numFishermen <= 11)
  39.                 {
  40.                     rentalPrice = rentalPrice - (rentalPrice * 0.15);
  41.                 }
  42.                 else
  43.                 {
  44.                     rentalPrice = rentalPrice - (rentalPrice * 0.25);
  45.                 }
  46.  
  47.                 if (numFishermen % 2 == 0 && season != "Autumn")
  48.                 {
  49.                     rentalPrice = rentalPrice - (rentalPrice * 0.05);
  50.                 }
  51.  
  52.                 if (rentalPrice > budget)
  53.                 {
  54.                     Console.WriteLine($"Not enough money! You need {rentalPrice - budget:F2} leva.");
  55.                 }
  56.                 else
  57.                 {
  58.                     Console.WriteLine($"Yes! You have {budget - rentalPrice:F2} leva left.");
  59.                 }
  60.         }
  61.     }
  62. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement