Advertisement
Guest User

Untitled

a guest
Jan 20th, 2019
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.90 KB | None | 0 0
  1. using System;
  2.                    
  3. public class Program
  4. {
  5.     static void Main(string[] args)
  6.     {
  7.         double vacationCost = double.Parse(Console.ReadLine());
  8.         int puzzles = int.Parse(Console.ReadLine());
  9.         int dolls = int.Parse(Console.ReadLine());
  10.         int teddyBears = int.Parse(Console.ReadLine());
  11.         int minions = int.Parse(Console.ReadLine());
  12.         int trucks = int.Parse(Console.ReadLine());
  13.  
  14.         double sum = (puzzles * 2.6) + (dolls * 3) + (teddyBears * 4.1) + (minions * 8.2) + (trucks * 2);
  15.  
  16.         int howManyToys = puzzles + dolls + teddyBears + minions + trucks;
  17.  
  18.         double totalPrice = sum;
  19.        
  20.         if (howManyToys >= 50)
  21.         {
  22.             totalPrice *= 0.75;
  23.         }
  24.        
  25.         totalPrice *= 0.9;
  26.        
  27.         if (vacationCost <= totalPrice)
  28.         {
  29.             Console.WriteLine("Yes! {0:f2} lv left.", totalPrice - vacationCost);
  30.         }
  31.         else
  32.         {
  33.             Console.WriteLine("Not enough money! {0:f2} lv needed.", Math.Abs(totalPrice - vacationCost));
  34.         }
  35.     }
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement