This week only. Pastebin PRO Accounts Christmas Special! Don't miss out!Want more features on Pastebin? Sign Up, it's FREE!
Guest

Untitled

By: a guest on Feb 2nd, 2013  |  syntax: C++  |  size: 0.69 KB  |  views: 31  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. //Jose Ed. Dieck
  2. //Prob 13 Shipping Charges
  3.  
  4. #include<iostream>
  5. #include<iomanip>
  6. using namespace std;
  7.  
  8. int main(){
  9.  
  10.         float weight, cost;
  11.         int distance;
  12.  
  13.         cout<<"What is the weight of the item?(in kg): ";
  14.         cin>>weight;
  15.         cout<<"What is the distance of the journey?(in miles): ";
  16.         cin>>distance;
  17.  
  18.         if((weight<= 0 || weight > 20)||(distance<10 || distance>3000))
  19.                 cout<<"Unacceptable weight or distance parameters, please restart the program.";
  20.  
  21.         if(weight<2)
  22.                 cost = 1.1 * (weight/500);
  23.         else if (weight >2 && weight <= 6)
  24.                 cost = 2.2 * (weight/500);
  25.         else if (weight > 6 && weight <= 10)
  26.                 cost = 3.7 * (weight/500);
  27.         else
  28.                 cost = 4.8 * (weight/500);
  29.  
  30.  
  31.  
  32.  
  33.  
  34.  
  35.         return 0;
  36. }
clone this paste RAW Paste Data