Question: A shipping company uses the following function to calculate the cost (in dollars) of shipping based on the weight of the package (in pounds). Write

A shipping company uses the following function to calculate the cost (in dollars) of shipping based on the weight of the package (in pounds).

3.5, if 0 < w

Write a program that prompts the user to enter the weight of the package and displays the shipping cost. If the weight is negative or zero, display a message “Invalid input.” If the weight is greater than 20, display a message “The package cannot be shipped.”

3.5, if 0 < w

Step by Step Solution

3.43 Rating (169 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

import javautilScanner public class Exe... View full answer

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 Introduction to Java Programming and Data Structure Questions!