Question: PLEASE HELP! JAVA A shipping company uses the following function to calculate the cost in dollars of shipping based on the weight of the package

PLEASE HELP! JAVA

A shipping company uses the following function to calculate the cost in dollars of shipping based on the weight of the package (in pounds) Note that if you already checked and the weight is NOT less than or equal 1 pound (say its 1.5 pounds), that means its automatically greater than one pound so you dont have to check in the next if statement if its greater than 1 pound, since it must be otherwise you would not be testing if its less than or equal to 3 pounds. Just check that its less than or equal to 3 pounds. No AND or OR conditions are required (which we havent learned yet).

Weight Cost
Less than or equal to 0 pounds display a message Invalid input
Less than or equal to 1 pound $3.50
Greater than 1 but less than or equal to 3 pounds $5.50
Greater than 3 but less than or equal to 10 pounds $8.50
Greater than 10 bit less than or equal to 20 pounds $10.50
If the weight is greater than 20 pounds, display a message The package cannot be shipped

Write a program that prompts the user to enter the weight of the package and displays the shipping cost or an appropriate error message. Test your program with the following inputs: -10

0

0.5

1

7.25

20

21

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!