+ 2

Programming test review! Stuf about classes

Can someone please help me with the following. Thank you! Design a class Number 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 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 key dollar amounts into the desired format. 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 nonnegative integer and uses it to initiate the Numbers object. It should have a member function print() that prints the English description of the Number 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.

31st Mar 2017, 2:32 AM
Adiel Cowo
Adiel Cowo - avatar
3 Answers
+ 14
@Tashi N, looks like C++
18th Apr 2017, 1:34 PM
SoraKatadzuma
SoraKatadzuma - avatar
+ 13
Looks like your homework. What have you done so far? Btw, you forgot to mention the programming language
18th Apr 2017, 1:27 PM
Tashi N
Tashi N - avatar
0
It was review for my test last month. Oh and it's supposed to be in c++
18th Apr 2017, 4:37 PM
Adiel Cowo
Adiel Cowo - avatar