Advertisement
Guest User

Untitled

a guest
Oct 21st, 2019
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.41 KB | None | 0 0
  1. using System;
  2.  
  3. namespace ToysShop
  4. {
  5.     class Program
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.             decimal priceTour = decimal.Parse(Console.ReadLine());
  10.             int numberPuzzels = int.Parse(Console.ReadLine());
  11.             int numberDolls = int.Parse(Console.ReadLine());
  12.             int numberBears = int.Parse(Console.ReadLine());
  13.             int numberMinions = int.Parse(Console.ReadLine());
  14.             int numberTrucks = int.Parse(Console.ReadLine());
  15.  
  16.             int totalCount = numberPuzzels + numberDolls + numberBears + numberMinions + numberTrucks;
  17.  
  18.             decimal totalPrice = 0;
  19.             totalPrice = numberPuzzels * (decimal)2.6
  20.                 + numberDolls * (decimal)3
  21.                 + numberBears * (decimal)4.1
  22.                 + numberMinions * (decimal)8.2
  23.                 + numberTrucks * (decimal)2;
  24.  
  25.             decimal remains;
  26.  
  27.             if (totalCount >= 50){
  28.                 totalPrice = totalPrice * 0.75m;
  29.             }
  30.  
  31.             totalPrice = totalPrice * 0.9m;
  32.             remains = Math.Abs(priceTour - totalPrice);
  33.  
  34.             if (priceTour <= totalPrice){
  35.                 //remains = totalPrice - priceTour;
  36.                 Console.WriteLine($"Yes! {remains:F2} lv left.");
  37.             }
  38.             else{
  39.                 Console.WriteLine($"Not enough money! {remains:F2} lv needed.");
  40.             }
  41.         }
  42.     }
  43. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement