Answered step by step
Verified Expert Solution
Question
1 Approved Answer
The Fast Freight Shipping company charges the following rates: Weight of package (in kilograms) 2 kg or less Over 2 kg but not more than
The Fast Freight Shipping company charges the following rates: Weight of package (in kilograms) 2 kg or less Over 2 kg but not more than 6 kg Over 6 kg but not more than 10k Over 10 kg but not more than 20 kg Rate per 500 miles shipped $1.10 $2.20 $3.70 $4.80 Write a program that asks for the weight of the package and the distance to be shipped, then displays the charges Note: To calculate the charges, the distance is rounded up to the next higher multiple of 500 miles. For example, a distance of 510 miles is rounded up to 1,000 miles, or 2 times 500 miles. If the package weights say 1kg, the charge will be $1.10 times 2, that is $2.20. If the package weights 5.5 kg, the charge will be $2.20 times 2, that is $4.40. A distance which is an integral multiple of 500 miles, say 2,000 miles, is not rounded up. If the distance is 2,000 miles and the weight is 3 kg, the charge will be $2.20 times 4, that is $8.80 1. Additional requirements-Make sure you meet all the requirements to avoid losing points e To complete the assignment, you are required to use only what has been taught in class, If you have prior programming experience, refrain from using more advanced C++ constructs, so all the homework programs can be graded on a consistent basis. . Make sure you follow the requirements in the "Homework Notes". You are required to implement the following functions and call them in the main function: getWeight: prompts the user to enter the weight, and checks the weight inputted is valid. The function should use a while loop for input validation and prompt the user to reenter the weight as long as it is invalid. Returns the weight as a double if the weight is valid. A weight is valid if it is > 0 and= 10 miles and 3,000 miles. Those are the company's minimum and maximum shipping distances o o
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