Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Please write in C++ Write a program that displays a simulated paycheck. The prog

ID: 3828130 • Letter: P

Question

Please write in C++

Write a program that displays a simulated paycheck. The program should ask the user to enter the date, the payee's name, and the amount of the check (up to $10,000). It should then display a simulated check with the dollar amount, both in digits and spelled out. For example: Date: 10/08/2016 Pay to the Order of: John Doe $1920.85 One thousand nine hundred twenty and 88/100... Dollars Be sure to format the numeric value of the check in fixed-point notion with two decimal places of precision. Be sure the decimal places are always displayed, even when the number is a whole number. Input Validation: Do not accept negative dollar amounts, or amounts over $10,000.

Explanation / Answer

#include #include #include #include #include "TextVersionOfNumber.h" using namespace std; string TextVersionOfNumber::convertNumberToText() { 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"}; double amount; int a = amount/1000; int b = (amount/100) - (a*10); int c = (amount/10) - (a*100) - (b*10); int d = amount - (a*1000) - (b*100) - (c*10); int cents = (amount*100) - (a*100000) - (b*10000) - (c*1000) - (d*100); if (a >= 1) amount_string = one_19[a] + " thousand " + one_19[b] + " hundred " } void TextVersionOfNumber::setAmount(double DollarAmount) { DollarAmount = amount; }