Advertisement
Spocoman

Family Trip

Nov 25th, 2021
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.03 KB | None | 0 0
  1. using System;
  2.  
  3. namespace FamilyTrip
  4. {
  5.     class Program
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.             double budget = double.Parse(Console.ReadLine());
  10.             int overnight = int.Parse(Console.ReadLine());
  11.             double overnightPrice = double.Parse(Console.ReadLine());
  12.             double additionalCosts = double.Parse(Console.ReadLine());
  13.             double totalPrice = 0;
  14.  
  15.             if (overnight > 7)
  16.             {
  17.                 totalPrice = overnight*(overnightPrice * 0.95) + (additionalCosts * budget / 100);
  18.             }
  19.             else
  20.             {
  21.                 totalPrice = overnight * overnightPrice + additionalCosts * budget / 100;
  22.             }
  23.             if (totalPrice <= budget)
  24.             {
  25.                 Console.WriteLine($"Ivanovi will be left with {budget - totalPrice:F2} leva after vacation.");
  26.             }
  27.             else
  28.             {
  29.                 Console.WriteLine($"{totalPrice - budget:F2} leva needed.");
  30.             }
  31.         }
  32.     }
  33. }
  34.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement