Question: I need some C++ homework assistance. The code I have entered below isn't prompting a message when the user enters weights of zero pounds or

I need some C++ homework assistance. The code I have entered below isn't prompting a message when the user enters weights of zero pounds or over 10 pounds. Can someone assist me with correcting this code so that when a user enters weights outside of the acceptable range (zero or greater than 10) they recieve a prompt that the "weight is invalid"....here is the code I have so far...

I need some C++ homework assistance. The code I have entered below

C++ code

#include

using namespace std;

int main() { float wt; //for package weight1.51 int dist; //for distance int seg; /o. of segments double rate1=1.50;//for 2pounds or less double rate2=3.70;//for more than 2 and less than or equals to 6 double rate3=5.25;//for more than 6 and less than or equals to 10

cout>wt;

cout>dist;

//calculating no. of segments seg=(dist/500)+((dist%500)>0?1:0);

if(wt>10 && wt

cout2&&wt6&&wt

return 0; }

options compilationexecution Enter package weight in pounds 12.8 Enter distance to be shipped in miles 50 Exit code: 0 (normal program termination)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!