Design a class Numbers that can be used to translate whole dollar amounts in the range0 through 9999 into an English description of the number. For example, the number713 wou ld be translated into the string seven hundred thirteen, and 8203 would betranslated into eight thousand two hundred three.The class should have a single integer member variablei nt number;and a collection of static string members that specify how to translate key dollaramounts into the desired format . For example, you might use static strings such asstring lessTha n20[ ] ={" zero ", "one", ... 1 "e igh tee n", "nineteen"};string hundred= "hundred";string tho us and= "t housa nd";The class shou ld have a constructor that accepts a non -negative integer and uses it toinitialize the Numbers object. It should have a member function pri nt () that prints theEnglish description of the Numbers object. Demonstrate the class by writing a mainprogram that asks the user to enter a number in the proper range and then prints outits English description .
Design a class Numbers that can be used to translate whole dollar amounts in the range
0 through 9999 into an English description of the number. For example, the number
713 wou ld 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
i nt number;
and a collection of static string members that specify how to translate key dollar
amounts into the desired format . For example, you might use static strings such as
string lessTha n20[ ] =
{" zero ", "one", ... 1 "e igh tee n", "nineteen"};
string hundred= "hundred";
string tho us and= "t housa nd";
The class shou ld have a constructor that accepts a non -negative integer and uses it to
initialize the Numbers object. It should have a member function pri nt () that prints the
English description of the Numbers object. Demonstrate the class by writing a main
program that asks the user to enter a number in the proper range and then prints out
its English description .
Trending now
This is a popular solution!
Step by step
Solved in 3 steps with 6 images