Create a java program displays the non-zero denomination


Discuss the below:

Q: Create a Java program that displays the non-zero denominations only. Display singular words for single units like 1 dollar and 1 penny, and display plural words for more than one unit like 2 dollars and 3 pennies. (Use 23.67 to test your programs.)

If the user enters zero or a negative amount, my program should exit properly and display a message stating that the amount entered by the user was zero or negative.

If input is 0, my output should be:
My amount is zero.

If input is -2000.25, my output should be:
My amount is negative.

If input is 23.67, my output should be:
My amount 23.67 consists of
23 dollars
2 quarters
1 dime
1 nickel
2 pennies

The input and output must use JOptionPane dialog and display boxes.

 

Solution Preview :

Prepared by a verified Expert
JAVA Programming: Create a java program displays the non-zero denomination
Reference No:- TGS01935074

Now Priced at $20 (50% Discount)

Recommended (92%)

Rated (4.4/5)