Advertisement
Guest User

Untitled

a guest
Jan 20th, 2019
189
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.05 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 * 0.9;
  19.        
  20.         if (howManyToys >= 50)
  21.         {
  22.             totalPrice *= 0.75;
  23.         }
  24.        
  25.         if (vacationCost <= totalPrice)
  26.         {
  27.             Console.WriteLine("Yes! {0:f2} lv left.", totalPrice - vacationCost);
  28.         }
  29.         else
  30.         {
  31.             Console.WriteLine("Not enough money! {0:f2} lv needed.", Math.Abs(totalPrice - vacationCost));
  32.         }
  33.     }
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement