Can someone help me with this in C++. Thank you! We would like to write a check.
ID: 3822631 • Letter: C
Question
Can someone help me with this in C++. Thank you!
We would like to write a check. Input the following: Date, Payee, Amount, and the account holder. Output these in the following format, but the amount needs to be output numerically as well as grammatically just like a check. Range for the check amount = $1 to $1999 (integers, no cents) Input the following 4 values Date: 01/01/15 Payee: John Doe Amount: $811 Account Holder: Jane Doe Output a written check Jane Doe STREET ADDRESS CITY, STATE ZIP Date: 01/01/15 Pay to the Order of: John Doe $ 811.00 Eight Hundred Eleven and no/100s Dollars BANK OF CSC5 FOR: GOTTA PAY THE RENT Jane Doe
Explanation / Answer
#include <conio.h>
#include <stdlib.h>
#include <stdio.h>
#include<iomanip.h>
#include<iostream.h>
#include<math.h>
using namespace std;
{
int balance,deposits,withdrawas;
cout << "Please enter the current bal in checkbook: " <<
cin >> bal;
return bal;
}
int addMoney(int deposits, int withdrawas)
{
int total = 0;
cout << "Enter a -ntv number for withdraws"<< endl;
int money;
do
{
cout << " deposit or withdraw money into the account: 0 ends the transaction " <<
cin >> money;
total += money;
if (money > 0 ) ++deposits;
else if (money < 0) ++withdrawas;
}
while (money != 0);
return total;
}
char OutputData(int balance, int withdrawas, int deposits, int total)
{
char decision;
cout << "Opening balance: " << balance <<
cout << "Num of Deposits: " << deposits <<
cout << "Num of Withdrawls: " << withdrawas <<
balance += total;
cout << "Closing Balance: " << balance << endl;
cout << "To balance other checkbook press yes, press no to quit the program: " <<
cin >> decision;
return decision;
}
int main()
{
char decision = 0;
int total, money;
money = 0;
balance = 0;
deposits = 0;
withdrawas = 0;
total = 0;
int finish = 1;
do
{
balance = askUser();
total = addMoney(deposits, withdrawas);
decision = OutputData(balance, withdrawas, deposits, total);
}
while (decision == 'yes');
system("pause");
}