The Fast Freight Shipping Company charges the following rates:
Weight of Package Rate per Pound
2 pounds or less $1.10
Over 2 pounds but not more than 6 pounds $2.20
Over 6 pounds but not more than 10 pounds $3.70
Over 10 pounds $3.80
Design a program that asks the user to enter the weight of a package and then displays the shipping charges.
So we have to include modules in the program. There's an error with the logical operators and an error at the "else" statements saying "expected a ;"
Can someone please help me with this program and give any tips?
#include <iostream>
#include <string>
using namespace std;
//Module to get weight of package in pounds
double getPackageWeight()
{
double weight;
cout << "Enter the weight of the package (in pounds):" << endl;
cin >> weight;
return weight;
}
Please edit your post and make sure your code is [code]between code tags[/code] so that it has line numbers and syntax highlighting, as well as proper indentation.
The errors you are getting are because you forgot to wrap round parenthesis around the conditions. Right now you only have round parenthesis around the individual parts, but you need an additional set around the whole thing.
I believe he means modular programming. Kinda sorta separating functions in terms of what they do, I guess. At least that's the only thing that comes to mind when @OP says "module".