Click here to Skip to main content
15,867,756 members
Please Sign up or sign in to vote.
1.00/5 (3 votes)
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:

int main() {
   
   /* Modify the following code */
   
   int volumeOunces;
   int volumeGallons;
   
   cin >> volumeOunces;
   
   volumeGallons = volumeOunces / 128;
   
   cout << fixed << setprecision(3) << volumeGallons << " gallons" << endl;
Posted
Updated 11-Jul-23 1:44am

While we are more than willing to help those that are stuck, that doesn't mean that we are here to do it all for you! We can't do all the work, you are either getting paid for this, or it's part of your grades and it wouldn't be at all fair for us to do it all for you.

So we need you to do the work, and we will help you when you get stuck. That doesn't mean we will give you a step by step solution you can hand in!
Start by explaining where you are at the moment, and what the next step in the process is. Then tell us what you have tried to get that next step working, and what happened when you did.

And the code you show has nothing at all to do with the question ...

If you are having problems getting started at all, then this may help: How to Write Code to Solve a Problem, A Beginner's Guide[^]
 
Share this answer
 
It looks you have grabbed a random piece of code from the net written a code loosely related with the requirements.
That said, creating a constant in C++ it is pretty straightforward, e.g.
C++
const int CENTS_PER_POUND = 25;
In a similar way you create FLAT_FEE_CENTS.
You may then have a look at https://cplusplus.com/doc/tutorial/basic_io/[^] in order to learn the basics of C++ and eventually complete your assignment.
 
Share this answer
 
Comments
BernardIE5317 30-Jan-23 9:04am    
step one was kindly given you by CPallini .
Perhaps the next step would be step two .

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900