Advertisement
Spocoman

Add Bags

Sep 14th, 2023
1,262
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.66 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main() {
  6.     double priceOver20kg, bagWeight;
  7.     cin >> priceOver20kg >> bagWeight;
  8.  
  9.     int dayBefore, bagCount;
  10.     cin >> dayBefore >> bagCount;
  11.  
  12.     if (bagWeight < 10) {
  13.         priceOver20kg /= 5;
  14.     }
  15.     else if (bagWeight <= 20) {
  16.         priceOver20kg /= 2;
  17.     }
  18.  
  19.     if (dayBefore < 7) {
  20.         priceOver20kg *= 1.4;
  21.     }
  22.     else if (dayBefore <= 30) {
  23.         priceOver20kg *= 1.15;
  24.     }
  25.     else if (dayBefore > 30){
  26.         priceOver20kg *= 1.1;
  27.     }
  28.  
  29.     double total = priceOver20kg * bagCount;
  30.  
  31.     printf("The total price of bags is: %.2f lv.\n", total);
  32.  
  33.     return 0;
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement