Answered step by step
Verified Expert Solution
Link Copied!

Question

...
1 Approved Answer

Write a solution to this problem in the main method of a class named Money Ask the user to enter a number representing


  • Write a solution to this problem in the main method of a class named "Money"
  • Ask the user to enter a number representing an amount of money from 1 dollar to 9999 dollars (integer). Assume the user is kind and will enter an integer number within this range.
  • Output the number of "bucks" (single dollar), "sawbucks" (10s), "Benjamins" (100) and "grands" (1000) corresponding to the amount entered by the user. For example if the user enters 7528, the program should output:
    • 7 grands
    • 5 Benjamins
    • 2 sawbucks
    • 8 bucks

TIP: you can decompose the total amount by using integer division and mod (%) operator. For example dividing by 1000 will give you the number of "grands", and then doing the mod 1000 will give you the reminder that has to be then divided by 100 to get the "Benjamins", and so on. You do not need to use loops.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Entrepreneurship

Authors: Andrew Zacharakis, William D Bygrave

5th Edition

9781119563099

More Books

Students also viewed these Algorithms questions