grach

2017_May_07 Toy Shop

Jan 27th, 2019
130
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.46 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 _2017_07_May_Toy_Shop
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             var Travel = double.Parse(Console.ReadLine());
  14.             var Puzzles = double.Parse(Console.ReadLine());
  15.             var speakDoll = double.Parse(Console.ReadLine());
  16.             var teddyBear = double.Parse(Console.ReadLine());
  17.             var minion = double.Parse(Console.ReadLine());
  18.             var trucks = double.Parse(Console.ReadLine());
  19.  
  20.             var toys = Puzzles + speakDoll + teddyBear + minion + trucks;
  21.  
  22.             var puzzlePrice = 2.60;
  23.             var spekDollPri = 3.00;
  24.             var teddyBeaPri = 4.10;
  25.             var minionPrice = 8.20;
  26.             var trucksPrice = 2.00;
  27.  
  28.             var totalPrice = puzzlePrice*Puzzles + spekDollPri*speakDoll + teddyBeaPri*teddyBear + minionPrice*minion+trucksPrice*trucks;
  29.  
  30.             if (toys>=50)
  31.             {
  32.                 totalPrice -= totalPrice * 0.25;
  33.             }
  34.  
  35.             totalPrice -= totalPrice * 0.1;
  36.  
  37.             if (totalPrice >= Travel)
  38.             {
  39.                 Console.WriteLine($"Yes! { (totalPrice - Travel):f2} lv left.");  
  40.             }
  41.             else
  42.             {
  43.                 Console.WriteLine($"Not enough money! {Math.Abs(Travel-totalPrice):f2} lv needed.");    
  44.             }
  45.  
  46.         }
  47.     }
  48. }
Advertisement
Add Comment
Please, Sign In to add comment