Question
Develop a program that involves data input, variables, and arithmetic operations. Shipping Charges Program The Fast Freight Shipping Company charges following rates Weight of Packages
Develop a program that involves data input, variables, and arithmetic operations.
Shipping Charges Program
The Fast Freight Shipping Company charges following rates
Weight of Packages (pounds) | Rate per 500 miles Shipped |
2 => weight | $1.10 |
2 < weight <= 6 | $2.20 |
6 < weight <= 10 | $3.70 |
10 < weight <= 20 | $4.80 |
Write a C++ program that asks for the weight of the package and the distance to be shipped. Then, compute the total charge. Charge is computed in 500 mile increments. For example, if the weight of the package is 3 pounds and distance to travel is 680 miles, then the charge will be
$2.20 * 2 = $4.40
You might need to use the ceil() method defined the cmath library for this computation. Definition of ceil() method can be found @
http://www.cplusplus.com/reference/cmath/ceil/
Also, here is an example of its usage
int x=680;
int y = 500;
double range = ceil((static_cast
cout< Input validation: Do not accept 0 or less for the weight of the package. If the weight of the package is 0 or less, display the message weight should be a greater than 0 Do not accept more than 20 for the weight of the package. If the weight of the pages more than 20, display the message max weight should 20 Also, do not accept the distances of less than 10 and greater than 3000 (these are the companys min and mx shipping distances)
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started