Post a New Question

programming

posted by .

creat a logic for a program that continuously prompts the user for a numeric number of dollars until the user enters 0. pass each entered amount to a conversion method that displays breakdown of the passed amount into the fewest bills

  • programming -

    do your homework

  • programming -

    start
    Declarations
    num dollars
    dollars = inputDollarAmt()
    while dollars <> 0
    dollarConversion(dollars)
    dollars = inputDollarAmt()
    endwhile
    stop

    num inputDollarAmt()
    Declarations
    num dollars
    num QUIT = 0
    output “Enter a dollar amount or ”, QUIT, “ to quit”
    input dollars
    return dollars

    void dollarConversion(num dolls)
    Declarations
    num twenties
    num tens
    num fives
    num ones
    twenties = dolls / 20
    dolls = dolls % 20
    tens = dolls / 10
    dolls = dolls % 10
    fives = dolls / 5
    dolls = dolls % 5
    ones = dolls
    output “You will need: ”, twenties, “ 20s, ”, tens, “ 10s, ”,
    fives, “ 5s, and ”, ones, “ 1s”
    return

Respond to this Question

First Name
School Subject
Your Answer

Similar Questions

More Related Questions

Post a New Question