Guest User

HungryGarfield

a guest
Jul 3rd, 2016
162
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.36 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 HungryGarfield
  8. {
  9. class HungryGarfield
  10. {
  11. static void Main(string[] args)
  12. {
  13. decimal money = decimal.Parse(Console.ReadLine());
  14. decimal rate = decimal.Parse(Console.ReadLine());
  15. decimal pizzaPrice = decimal.Parse(Console.ReadLine());
  16. decimal lasagnaPrice = decimal.Parse(Console.ReadLine());
  17. decimal sandwichPrice = decimal.Parse(Console.ReadLine());
  18. uint pizzaQuantity = uint.Parse(Console.ReadLine());
  19. uint lasagnaQuantity = uint.Parse(Console.ReadLine());
  20. uint sandwichQuantity = uint.Parse(Console.ReadLine());
  21.  
  22. decimal moneyNeeded = (pizzaPrice * pizzaQuantity + lasagnaPrice * lasagnaQuantity + sandwichPrice * sandwichQuantity) / rate;
  23. decimal moneyDifference = money - moneyNeeded;
  24.  
  25. if (moneyDifference >= 0)
  26. {
  27. Console.WriteLine("Garfield is well fed, John is awesome. Money left: ${0}.", Math.Round(moneyDifference, 2));
  28. }
  29.  
  30. else
  31. {
  32. Console.WriteLine("Garfield is hungry. John is a badass. Money needed: ${0}.", Math.Abs(Math.Round(moneyDifference, 2)));
  33. }
  34. }
  35. }
  36. }
Advertisement
Add Comment
Please, Sign In to add comment