Small Basic Exercise: Counting Garage Sale Money


Eve’s mom is running a garage sale. Eve wants to earn some money, so she sets up a table to sell lemonade, cookies, and her homemade greeting cards as the customers come up the driveway (she’s cute, so she sells a lot).

Help Eve count the money her customers give her by creating a program that converts the number of dollars, quarters, dimes, nickels, and pennies entered by a user and then converts them into a total dollar amount (try it with these amounts to make sure it works):

35 dollars, 3 quarters, 3 pennies

2 dollars, 1 quarter, 2 pennies

10 dollars, 1 nickel, 3 pennies

6 dollars, 1 quarter, 3 pennies

3 dollars, 2 quarters, 1 dime, 1 nickel, 3 pennies

1 dollar, 2 dimes, 1 nickel, 4 pennies

Next, see if you can personalize your program for Eve. Eve really exists (she's my daughter).

Leave a comment to share your program with Eve!

 

Have a Small and Basic day!

    - Ninja Ed

Comments (1)

  1. Computers Today (part 1 of 6)

    blogs.msdn.com/.../computers-today.aspx

    .....

    CS SPOTLIGHT: Girls in computer programming... why it matters!!!

    blogs.msdn.com/.../cs-spotlight-girls-in-computer-programming-why-it-matters.aspx

    ...

    Computational Thinking - Videos & Papers by Jeannette Wing

    blogs.msdn.com/.../computational-thinking-videos-amp-papers-by-jeannette-wing.aspx

Skip to main content