Question
Write program in Java. You work for a package shipping company and are writing a program to determine shipping rates. The rates are determined by
Write program in Java.
You work for a package shipping company and are writing a program to determine shipping rates.
The rates are determined by the following rules: If a package weighs less than 16 ounces and measures less than 12 inches wide, the shipping rate is $1 to deliver it anywhere in the continental US.
If a package weighs 16 ounces or more or measures 12 inches wide or more, the shipping rate is determined by multiplying the weight in ounces by $0.10 and the width in inches by $0.15.
The shipping rate is the greater of the two numbers. If shipping to Alaska or Hawaii, the shipping rate is doubled. Shipping rates are capped at $10. Prompt the user for the weight and width of the package and what state it is going to.
Tell the user how much it will cost to send the package.
Name your program ShippingRates.
Sample Output:
What is the weight of the package (in ounces)? 10
What is the length of the package (in inches)? 30
What state is the destination? Minnesota
The shipping cost is $4.50
Note: use System.out.printf to ensure 2 decimals are output for the answer.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
import javautilScanner public class ShippingRates public static void mainString args Scanner scanner ...Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started