Question: in DrJava Download the file Shipping.java. Write the code for calculating the shipping rate, as described in the attached assignment description. import java.util.Scanner; e public

Download the file Shipping.java. Write the code for calculating the shipping rate, as described in the attached assignment description. import java.util.Scanner; e public class Shipping { public Shipping ( { } public double calcRate (double weight) { //Return value: shipping cost double cost; return cost; } } The calcRate() method will calculate the shipping rate, based upon the weight of the package (which is provided in the variable named weight). That rate is calculated as follows: if the package is two pounds or less, the shipping rate is $2.99 if the package is between two and four pounds, the shipping rate is $4.99 if the package is greater than four pounds, the rate is $4.99 plus $1.20 for each pound above four pounds. It must be a complete pound, so a package that weighs 4.9 pounds has the same shipping rate as a package that weighs 4 pounds. Also, the user might purchase insurance. Use the Scanner to ask the user if they want to purchase insurance. If they do, then add $3 to the shipping rate. Put your shipping cost into the variable named cost that is already declared in the code
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
