Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace garden
- {
- class garden
- {
- static void Main()
- {
- decimal tomatoSeeds = decimal.Parse(Console.ReadLine());
- int tomatoArea = int.Parse(Console.ReadLine());
- decimal cucumberSeeds = decimal.Parse(Console.ReadLine());
- int cucumberArea = int.Parse(Console.ReadLine());
- decimal potatoSeeds = decimal.Parse(Console.ReadLine());
- int potatoArea = int.Parse(Console.ReadLine());
- decimal carrotSeeds = decimal.Parse(Console.ReadLine());
- int carrotArea = int.Parse(Console.ReadLine());
- decimal cabbageSeeds = decimal.Parse(Console.ReadLine());
- int cabbageArea = int.Parse(Console.ReadLine());
- decimal beanSeeds = decimal.Parse(Console.ReadLine());
- decimal tomatoPrice = 0.5M;
- decimal cucumberPrice = 0.4M;
- decimal potatoPrice = 0.25M;
- decimal carrotPrice = 0.6M;
- decimal cabbagePrice = 0.3M;
- decimal beansPrice = 0.4M;
- decimal tomatoCost = tomatoSeeds * tomatoPrice;
- decimal cucumberCost = cucumberSeeds * cucumberPrice;
- decimal potatoCost = potatoSeeds * potatoPrice;
- decimal carrotCost = carrotSeeds * carrotPrice;
- decimal cabbageCost = cabbageSeeds * cabbagePrice;
- decimal beansCost = beanSeeds * beansPrice;
- int totalArea = 250;
- decimal totalPrice = tomatoCost + cucumberCost + potatoCost + carrotCost + cabbageCost + beansCost;
- double beansArea = totalArea - (tomatoArea + cucumberArea + potatoArea + carrotArea + cabbageArea);
- if((tomatoArea + cucumberArea + potatoArea + carrotArea + cabbageArea) > totalArea)
- {
- Console.WriteLine("Total costs: {0}", totalPrice, Math.Round(totalPrice, 2));
- Console.WriteLine("Insufficient area!");
- }
- else if (beansArea <= 0)
- {
- Console.WriteLine("Total costs: {0}", totalPrice, Math.Round(totalPrice, 2));
- Console.WriteLine("No area for beans!");
- }
- else
- {
- Console.WriteLine("Total costs: {0}", totalPrice, Math.Round(totalPrice, 2));
- Console.WriteLine("Beans area: {0}", beansArea, Math.Round(beansArea, 2));
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement