Advertisement
desislava_topuzakova

01. Swimming Pool

Feb 18th, 2023
148
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.91 KB | None | 0 0
  1. #include <iostream>
  2. #include <cmath>
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7. int countPeople;
  8. cin >> countPeople;
  9. double entryPrice, loungePrice, umbrellaPrice;
  10. cin >> entryPrice >> loungePrice >> umbrellaPrice;
  11. //парти -> вход, шезлонг, чадър
  12.  
  13. //1. обща цена за вход на всички
  14. double totalEntrySum = countPeople * entryPrice;
  15.  
  16. //2. обща цена за шезлонгите
  17. double totalLoungePrice = ceil(0.75 * countPeople) * loungePrice;
  18.  
  19. //3. обща цена за чадърите
  20. double totalUmrellaPrice = ceil(0.50 * countPeople) * umbrellaPrice;
  21.  
  22. //4. крайна цена за партито = сума за вход + сума за шезлонги + сума за чадъри
  23. double finalPrice = totalEntrySum + totalLoungePrice + totalUmrellaPrice;
  24.  
  25.  
  26. cout.setf(ios::fixed);
  27. cout.precision(2);
  28. cout << finalPrice << " lv.";
  29.  
  30.  
  31.  
  32.  
  33. }
  34.  
  35.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement