Advertisement
tsvetelinapasheva

TsvetelinaPasheva/FirstStepInCodingExercise/07.FruitMarket

Jan 10th, 2021
120
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.18 KB | None | 0 0
  1. using System;
  2.  
  3. namespace _07.FruitMarket
  4. {
  5.     class Program
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.             double strawberriesPrice = double.Parse(Console.ReadLine());
  10.             double bananasAmount = double.Parse(Console.ReadLine());
  11.             double orangesAmount = double.Parse(Console.ReadLine());
  12.             double raspberriesAmount = double.Parse(Console.ReadLine());
  13.             double strawberriesAmount = double.Parse(Console.ReadLine());
  14.  
  15.             double raspberriesPrice = strawberriesPrice / 2;
  16.             double orangesPrice = raspberriesPrice - (raspberriesPrice * 0.40);
  17.             double bananasPrice = raspberriesPrice - (raspberriesPrice * 0.80);
  18.  
  19.             double raspberriesNeededSum = raspberriesAmount * raspberriesPrice;
  20.             double orangesNeededSum = orangesAmount * orangesPrice;
  21.             double bananasNeededSum = bananasAmount * bananasPrice;
  22.             double strawberriesNeededSum = strawberriesAmount * strawberriesPrice;
  23.  
  24.             double neededSum = raspberriesNeededSum + orangesNeededSum + bananasNeededSum + strawberriesNeededSum;
  25.             Console.WriteLine($"{neededSum:F2}");
  26.  
  27.  
  28.         }
  29.     }
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement