Question: do not include namespace std Develop a C++ class called Dollars that will translate float number values in the range of 0 to 9999.99 inclusive

do not include namespace std

Develop a C++ class called Dollars that will translate float number values in the range of 0 to 9999.99 inclusive into its English description

For example, 713 would print out as "seven hundred thirteen dollars and no cents"

For example, 8203.77 would print out as "eight thousand two hundred three dollars and seventy seven cents"

The class needs to maintain solely a float member variable and a static array of string objects that specify translation for key dollar amounts into their desired formats

string lessThan20[20] = { "zero", "one", "two", ........, "seventeen", "eighteen", "nineteen" };

string hundred = "hundred";

string thousand = "thousand";

The Dollars class must have a constructor that takes in the dollar value and uses it for initialization

The value must be greater than or equal to 0 and less than 10000.00

You may presume that the cents amount is no more than a two digit number

The class must have a function called Print which prints the English description of the number

Demonstrate the class by completing a C++ program which asks the user to enter a number in the proper ranges and then displays its translated description

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!