Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

The Accidental Data Scientist

Authors: Amy Affelt

1st Edition

1573877077, 9781573877077

More Books

Students also viewed these Databases questions