Question: C++ Question: Given Tester file: // Chapter 12-- Assignment 14: Check Writer // This program can convert a dollar and cents amount given in //

C++ Question:

Given Tester file:

// Chapter 12-- Assignment 14: Check Writer // This program can convert a dollar and cents amount given in // numerical form to a word description of the amount. #include #include #include #include using namespace std;

#include "TextVersionOfNumber.h" // Assume a maximum amount of $10,000

int main() { string date = "03/05/2016", payee = "Maya Tolappa"; TextVersionOfNumber checkAmount; double testAmounts[] = { 0, .01, .25, 12, 12.45, 19, 19.02, 19.45, 20, 20.45, 34, 56.78, 100, 109, 119.78, 450, 678.90, 1000, 1009.45, 1056, 1234, 1567.98, 9999, 9999.99 };

for (int i = 0; i < sizeof(testAmounts) / sizeof(double); i++) { double an_amount = testAmounts[i]; checkAmount.setAmount(an_amount); cout << setprecision(2) << fixed; cout << setw(60) << right; cout << "Date: " << date << endl; cout << "Pay to the order of: " << payee << "\t\t\t"; cout << "$" << an_amount << endl; cout << checkAmount.getTextVersionOfNumber() << endl; cout << "--------------------------------------------------------------------- "; } cin.get(); return 0; }

Given h file:

#include #include #include using namespace std; class TextVersionOfNumber { private: double amount;

public: string getTextVersionOfNumber(); void setAmount(double); };

I need to return the numbers as a string using array processing with decision structures.

This is what I have so far...

#include "TextVersionOfNumber.h" string TextVersionOfNumber::getTextVersionOfNumber() { string one_19[] = { "", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine", "ten", "eleven", "twelve", "thirteen", "fourteen", "fifteen", "sixteen", "seventeen", "eighteen", "nineteen" };

string twenty_90[] = { "", "", "twenty", "thirty", "forty", "fifty", "sixty", "seventy", "eighty", "ninety" };

} void TextVersionOfNumber::setAmount(double _amount) { amount = _amount;

}

Is anyone able to finish this so that it works? I know that the tester and h file are correct, but i need help with the last file that I started. Thanks!

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!