Question: use python code to write the following program. The solution must include roundFloat(num) for formating floating point number. write a simple codes without defining variables
Write a program that calculates the shipping charges for parcel. The program should ask the user to enter two floating point values . The weight of a parcelin pounds The shipping rate per pound The program calculates and displays the total shipping charges based on the parcel's weight and shipping rate per pound Your program should print dollars and cents with two decimal places such as 32,85, and not 32.8467777 Until we learn how to format output, we will use this little trick. You can round a floating point value to the nearest hundredth by adding 0.005, multiplying by 100, converting the result to an integer, and then dividing by 100. This trick is not perfect but works well with most values Your solution must include the following function roundFloat(num)implements the trick for formatting floating point numbers as described above Here is a sample of what a typical run of this program looks like where the user entered the values 475 for the weight and 2.55 for the shipping rate per pound Shipping Charges Calculator Enter the weight of your parcel in pounds: 4.75 Enter the shipping price per pound: 2.55 The weight of your parcel is 4.75 pounds The shipping price per pound in 2.55 dollars The shipping charges for your parcel is 12.11 dollars Bott
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
