Need Help ?
Have a Question ?

(Solved): Design A Class Numbers That Can Be Used To Translate Whole Dollar Amounts In The Range Of 0 Through ...

  1. Design a class Numbers that can be used to translate whole dollar amounts in the range of 0 through 9999 into an English description of the number. For example, the number 713 would be translated into the string "seven hundred thirteen", and 8203 would be translated into "eight thousand two hundred three".

The class should have a single integer member variable:

  int number ;  

and a collection of static string members that specify how to translate dollar amounts amounts into the desired string format. (Should they also be constants?)

For example, you might use static strings such as:

  string lessThan20[ ] = "
            zero", "one", ..., " eighteen", "nineteen" } ;
  string hundred = "hundred" ;
  string thousand = "thousand" ;

The class should have a constructor that accepts a non-negative integer and uses it to initialize the Numbers object.

It also should have a member function print() that prints the English description of the Numbers object.

Demonstrate the class by writing a main program the asks the user to enter a number in the proper range and then prints out its English description on the console.

Submit all of your C++ code plus Printscreens (or snippets) demonstrating the following test cases: 5, 18, 295, 1019, and 9999.

Expert Answer

Answer: Hey dear student finds the solution of your query if you have any doubt feel free to ask. Thanks!! C++ Code: #include #include <string> using namespace std; //class declaration clas
We have an Answer from Expert Buy This Answer $6