Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- class Program
- {
- static void Main(string[] args)
- {
- var money = double.Parse(Console.ReadLine());
- var rate = double.Parse(Console.ReadLine());
- var pizzaPrice = double.Parse(Console.ReadLine());
- var lasagnaPrice = double.Parse(Console.ReadLine());
- var sandwichPrice = double.Parse(Console.ReadLine());
- var pizzaQuantity = double.Parse(Console.ReadLine());
- var lasagnaQuantity = double.Parse(Console.ReadLine());
- var sandwichQuantity = double.Parse(Console.ReadLine());
- var spentForPizza = (pizzaPrice / rate) * pizzaQuantity;
- var spentForLasagna = (lasagnaPrice / rate) * lasagnaQuantity;
- var spentForSandwich = (sandwichPrice / rate) * sandwichQuantity;
- var x = spentForLasagna + spentForPizza + spentForSandwich;
- if (x<=money)
- {
- Console.WriteLine("Garfield is well fed, John is awesome. Money left: ${0:0.00}.",money-x);
- }
- else
- {
- Console.WriteLine("Garfield is hungry. John is a badass. Money needed: ${0:0.00}." ,Math.Abs(money - x));
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment