Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

12. Check Writer Please read this entire question as this differs from the book Write a program that displays a simulated paycheck. The program should

12. Check Writer

Please read this entire question as this differs from the book

Write a program that displays a simulated paycheck. The program should ask the user to enter th date, the payee's name, and the amount of the check. It should then display a simulated check with the dollar amount spelled out. You may assume the amount is no greater than $10000. Be sure to format the numeric value of the check in fixed=point notation with two decimal places of precision. Be sure the decimal place always displays, even when the number is zero or has fractional part.l Use either C-strings or string class objects in this program.

In order to complete this assignment, create a class called TextVersionOfNumber

Be sure to not use a lot of "if" statements; use array processing.

(Here is the tester for the program)

// 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 iostream #include iomanip #include string #include string.h 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 << "--------------------------------------------------------------------- "; } return 0; }

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

Database Concepts

Authors: David M Kroenke, David J Auer

6th Edition

0132742926, 978-0132742924

More Books

Students also viewed these Databases questions

Question

d. How will lack of trust be handled?

Answered: 1 week ago

Question

b. Does senior management trust the team?

Answered: 1 week ago