Advertisement
svephoto

Charity Campaign [C#]

Mar 30th, 2021
696
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.17 KB | None | 0 0
  1. using System;
  2. namespace CharityCampaign
  3. {
  4.     class Program
  5.     {
  6.         static void Main(string[] args)
  7.         {
  8.             const double priceOfCake = 45;
  9.             const double priceOfWaffle = 5.80;
  10.             const double priceOfPancake = 3.20;
  11.  
  12.             int numberOfDaysForCampaign = int.Parse(Console.ReadLine());
  13.             int numberOfChefs = int.Parse(Console.ReadLine());
  14.             int numberOfCakes = int.Parse(Console.ReadLine());
  15.             int numberOfWaffles = int.Parse(Console.ReadLine());
  16.             int numberOfPancakes = int.Parse(Console.ReadLine());
  17.  
  18.             double sumOfCakes = numberOfCakes * priceOfCake;
  19.             double sumOfWaffles = numberOfWaffles * priceOfWaffle;
  20.             double sumOfPancakes = numberOfPancakes * priceOfPancake;
  21.  
  22.             double sumOfTotalProduct = (sumOfCakes + sumOfWaffles + sumOfPancakes) * numberOfChefs;
  23.             double totalSumForCampaign = sumOfTotalProduct * numberOfDaysForCampaign;
  24.             double expenses = totalSumForCampaign / 8;
  25.             double finalSum = totalSumForCampaign - expenses;
  26.  
  27.             Console.WriteLine($"{finalSum:f2}");            
  28.         }
  29.     }
  30. }
  31.  
  32.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement