Advertisement
svetoslav_0

ToyShop

Jan 9th, 2018
240
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.82 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 ToyShop
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             var vacantionPrice = double.Parse(Console.ReadLine());
  14.             var puzels = int.Parse(Console.ReadLine());
  15.             var dolls = int.Parse(Console.ReadLine());
  16.             var bears = int.Parse(Console.ReadLine());
  17.             var minions = int.Parse(Console.ReadLine());
  18.             var trucks = int.Parse(Console.ReadLine());
  19.  
  20.             var total = puzels * 2.60 + dolls * 3 + bears * 4.10 + minions * 8.20 + trucks * 2;
  21.             var totaltoys = puzels + dolls + bears + minions + trucks;
  22.             if (totaltoys >= 50)
  23.             {
  24.                 var billoff = total - (total * 0.25);
  25.                 var rent = billoff - (billoff * 0.10);
  26.                
  27.                 if (rent >= vacantionPrice)
  28.                 {
  29.                   var final = rent - vacantionPrice;
  30.                     Console.WriteLine("Yes! {0:f2} lv left.", final);
  31.                 }
  32.               else{
  33.                 var final = vacantionPrice - rent;
  34.                 Console.WriteLine($"Not enough money! {final:f2} lv needed.");
  35.               }
  36.             }
  37.             else if(totaltoys < 50)
  38.             {
  39.                 var rent2 = total - (total * 0.10);
  40.                
  41.                 if(rent2 <= vacantionPrice)
  42.                 {
  43.                     var final2 = vacantionPrice - rent2;
  44.                     Console.WriteLine("Not enough money! {0:f2} lv needed.", final2);
  45.                 }
  46.               else{
  47.                 var final2 = rent2 - vacantionPrice;
  48.                 Console.WriteLine($"Yes! {final2:f2} lv left.");
  49.               }
  50.             }
  51.  
  52.         }
  53.     }
  54. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement