Question: **JAVA** Please make sure there is the error message output for invalid inputs make the last system.out.print a println Starter code: public class LA1d {

**JAVA** Please make sure there is the error message output for invalid inputs make the last system.out.print a println
Starter code:
| public class LA1d { | |
| /** | |
| * Error message to display for negative amount | |
| */ | |
| public static final String ERR_MSG = "The package cannot be shipped!"; | |
| /** | |
| * Method to compute shipping cost | |
| * | |
| * @param weight, assumed to be in (0, 20] | |
| * @return cost to ship | |
| */ | |
| public static double shippingCost(double weight) { | |
| return 0.0; // TODO: replace with your method implementation | |
| } | |
| // TODO: document this method | |
| public static void main(String[] args) { | |
| // TODO: write your code here | |
| } | |
| } |
9.3. Part d A shipping company uses the following function to calculate the cost (in dollars) of shipping based on the weight of the package (in pounds). c(w) = $3.50 if 0
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
