Question
(JAVA) Assume a customer is shipping one or more packages. Your program prompts the user for two float values: the weight of a package in
(JAVA) Assume a customer is shipping one or more packages. Your program prompts the user for two float values: the weight of a package in pounds, a shipping price per pound and calculates the cost to ship the package(s). Your program should print dollars and cents with two decimal places such as $32.85, and not $32.8467777. After completing the calculation for the first package ask the user if there are additional packages, allow the user continue the loop of calculations as many times as desired.
Hint: You can use the format or printf methods we discussed in class. You get extra credit if you dare to round your floating point value x to the nearest hundredth, by adding .005, multiplying by 100, casting to an integer, casting back to a float, and dividing by 100.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
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