15,607,737 members
See more:
```The cost to ship a package is a flat fee of 75 cents plus 25 cents per pound.
1. Declare a const named CENTS_PER_POUND and initialize with 25.
2. Get the shipping weight from user input storing the weight into shipWeightPounds.
3. Using FLAT_FEE_CENTS and CENTS_PER_POUND constants, assign shipCostCents with the cost of shipping a package weighing shipWeightPounds.```

What I have tried:

```#include <iostream>
using namespace std;

int main() {
int shipWeightPounds;
int shipCostCents = 0;
const int FLAT_FEE_CENTS = 75;

/* Your solution goes here  */

cout << "Weight(lb): " << shipWeightPounds;
cout << ", Flat fee(cents): " << FLAT_FEE_CENTS;
cout << ", Cents per lb: " << CENTS_PER_POUND << endl;
cout << "Shipping cost(cents): " << shipCostCents << endl;

return 0;
}```
Posted
Updated 31-Mar-22 15:06pm

## Solution 1

Off the bat I can see you don't have one of the constants defined.

Zhen Gerald 1-Sep-21 17:20pm
help me solve that question please
Dave Kreskowiak 1-Sep-21 17:21pm
WHAT QUESTION? You haven't asked anything.
jeron1 1-Sep-21 17:28pm
Take a close look at instruction #1.
Dave Kreskowiak 1-Sep-21 17:29pm
I am not doing your homework for you. That is literally a single line of code.
jeron1 1-Sep-21 17:34pm
I agree! LOL :-)

## Solution 2

you need a function which calculates the costs like

C++
```int shippingCosts( int shipWeightPounds ) {
}```
Do the math yourself. And you need to declares the constants outside the main.

## Solution 3

3. Follow the instructions, step by step.

4. If in any of the above steps you encounter something that is not clear to you, read up on the topic in question in your course materials.

5. If and only if you've done everything of the above, and still don't understand something, formulate a question on that particular thing only.

Note: posting your entire homework assignment is not the same as asking about one particular thing that you don't understand. We cannot help you understand if you do not try to understand it first, and if you do not specify what it is that you do not understand. Solving your homework would by trivial for us, but doing so wouldn't help you understand, so it would be a waste of effort.

## Solution 5

const int CENTS_PER_POUND = 25;

cin>>shipWeightPounds;

shipCostCents = FLAT_FEE_CENTS + (shipWeightPounds * CENTS_PER_POUND);

Here goes the answer I hope this helps!!