Question: I need help with this C++ problem. Design a class called Numbers that can be used to translate integers in the range 0 to 9999
I need help with this C++ problem.
Design a class called Numbers that can be used to translate integers in the range 0 to 9999 into an English description of the number. The class should have a single integer member variable: int number; and a static array of string objects that specify how to translate the number into the desired format. For example, you might use static string arrays such as: string lessThan20[20] = {"zero", "one", ..., "eighteen", "nineteen"}; string hundred = "hundred"; string thousand = "thousand"; The class should have a constructor that accepts a nonnegative integer and uses it to initialize the Numbers object. It should have a member function, print(), that prints the English description of the Numbers object. Demonstrate the class in a main program that prompts the user to input a number and then prints out its English description.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
