Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Code a checkbook balancing program. The program will read in, from a user selected input file, the following for all checks that were not cashed

Code a checkbook balancing program. The program will read in, from a user selected input file, the following for all checks that were not cashed as of the last time you balanced your checkbook: the number of each check (int), the amount of the check (double), and whether or not it has been cashed (1 or 0 in the file, boolean in the array). Use an array with the class at the type. The class should be a class for a check. There should be three member variables to record the check number, the check amount, and whether or not the check was cashed. The class for a check will have a member variable of type Money (as defined on page 662 in the book; Display 11.9) to record the check amount. So, you will have a class used within a class. The class for a check should have accessor and mutator functions as well as constructors and functions for both input and output of a check. In addition to the checks, the program also reads all the deposits (from the console; cin), the old and the new account balance (read this in from the user at the console; cin). You may want another array to hold the deposits. The new account balance should be the old balance plus all deposits, minus all checks that have been cashed. The program outputs the total of the checks cashed, the total of the deposits, what the new balance should be, and how much this figure differs from what the bank says the new balance is. It also outputs two lists of checks: the checks cashed since the last time you balanced your checkbook and the checks still not cashed. Display both lists of checks in sorted order from lowest to highest check number.

CAN ONLY use #, , and .

NEEDS USER INPUT

Display 11.9

class Money

{

public:

friend Money operator +(const Money& amount1, const Money& amount2);

friend Money operator -(const Money& amount1, const Money& amount2);

friend Money operator -(const Money& amount);

friend bool operator ==(const Money& amount1, const Money& amount2);

Money (long dollars, int cents);

Money (long dollars);

Money ();

double getValue() const;

friend istream& operator >>(istream& ins, Money& amount);

friend ostream& operator <<(ostream& outs, const Money& amount);

private:

long allCents;

};

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_2

Step: 3

blur-text-image_3

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

Modern Dental Assisting

Authors: Doni Bird, Debbie Robinson

13th Edition

978-0323624855, 0323624855

Students also viewed these Programming questions