Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Jose Ed. Dieck
- //Prob 13 Shipping Charges
- #include<iostream>
- #include<iomanip>
- using namespace std;
- int main(){
- float weight, cost;
- int distance;
- cout<<"What is the weight of the item?(in kg): ";
- cin>>weight;
- cout<<"What is the distance of the journey?(in miles): ";
- cin>>distance;
- if((weight<= 0 || weight > 20)||(distance<10 || distance>3000))
- cout<<"Unacceptable weight or distance parameters, please restart the program.";
- if(weight<2)
- cost = 1.1 * (weight/500);
- else if (weight >2 && weight <= 6)
- cost = 2.2 * (weight/500);
- else if (weight > 6 && weight <= 10)
- cost = 3.7 * (weight/500);
- else
- cost = 4.8 * (weight/500);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement