Explore BrainMass

Explore BrainMass

    Java Programing: Non-Zero Denominations

    Not what you're looking for? Search our solutions OR ask your own Custom question.

    This content was COPIED from BrainMass.com - View the original, and get the already-completed solution here!

    Write 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.

    © BrainMass Inc. brainmass.com March 4, 2021, 8:36 pm ad1c9bdddf

    Solution Summary

    This response provides guidelines on writing a Java program that only displays non-zero denominations.