Guest User

Untitled

a guest
Jun 13th, 2018
127
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.06 KB | None | 0 0
  1. using System;
  2.  
  3. namespace Problem02_Styrofoam
  4. {
  5.     class Program
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.             double budget = double.Parse(Console.ReadLine());
  10.             double houseArea = double.Parse(Console.ReadLine());
  11.             int windows = int.Parse(Console.ReadLine());
  12.             double styrofoamInPackage = double.Parse(Console.ReadLine());
  13.             double styrofoamPricePerPackage = double.Parse(Console.ReadLine());
  14.  
  15.             double windowsArea = windows * 2.4;
  16.             houseArea -= windowsArea;
  17.             houseArea += houseArea * 0.1;
  18.             double packageNeed = Math.Ceiling(houseArea / styrofoamInPackage);
  19.             double price = packageNeed * styrofoamPricePerPackage;
  20.  
  21.             if (price > budget)
  22.             {
  23.                 Console.WriteLine("Need more: {0:F2}", price - budget);
  24.             }
  25.             else
  26.             {
  27.                 Console.WriteLine("Spent: {0:F2}", price);
  28.                 Console.WriteLine("Left: {0:F2}", budget - price);
  29.             }
  30.         }
  31.     }
  32. }
Advertisement
Add Comment
Please, Sign In to add comment