Question: (Java) Using the decision control structure Have 2 unrelated tasks performed in one Java file. Part 1 ) Prompt the user to enter his or
(Java) Using the decision control structure
Have 2 unrelated tasks performed in one Java file. Part 1 ) Prompt the user to enter his or her name and an amount of money in cents. Calculate and display the users name and the number of half-dollars, quarters, dimes, nickels, and pennies. The modulus operator will come in handy here.
Part 2 ) Write a program that calculates the shipping cost for packages based on the weight of the package.
Use the following set of decisions for calculating the shipping cost based on the weight of a package:
_ if the package weighs more than 0 pounds and less than 2 lbs, then the shipping cost is $0.75/lb _ if the package weighs between 2 and 10 lbs, then the shipping cost is $1.12/lb _ if the package weighs more than 10 lbs. and 25 lbs or less, then the shipping cost is $1.87/lb _ if the package weights over 25 lbs, then there is a at rate shipping cost of $50 _ if the package weights 0 or less, issue an error message and do not compute anything.
Part 1) SAMPLE RUN:
Enter your name: Billy Enter the amount of money in cents: 41 Number of half-dollars = 0 Number of quarters = 1 Number of dimes = 1 Number of nickels = 1 Number of pennies = 1
Part 2) SAMPLE RUN
Enter the package weight in lbs: 0 ERROR: Cannot process this data
Enter the package weight in lbs: 13 The shipping cost for a package weighing 13 lbs is $24.31
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
