Write a checkbook balancing program in C++. The program will read in the following information for all checks that were not cashed as of the last time the user balanced their checkbook: the number of each check the amount of the check whether or not the check has yet been cashed Use a dynamic array with a class base type for the checks. The check class should have three member variables: check number check amount whether or not the check's been cashed And don't forget to provide accessors, mutators, and constructors as well as input and output methods. BTW, the amount member variable will be of type Money. Just save this link to the Money class definition — you do not have to design it yourself! (A closer look, however, reveals that it is just a class definition... The definitions for the methods seem to be missing. Bummer...) In addition to all of the checks since the last checkbook update, your program should also read all of the user's deposits, the last balance we reported to them, and the new balance the bank reported to them. You will most likely desire a second [dynamic] array to hold all of the deposits. (A deposit is, of course, a Money type value.) Your program should calculate and print the total for all checks, the total for all deposits, the calculated new balance, and how much this differs from the reported new balance. (Just in case: the new account balance should be the old balance plus all deposits and minus all cashed checks.) Then display two lists of checks: those already cashed and those still not cashed. Sort each list from lowest to highest check number. (Note that this will not require you to split the checks into two arrays...) To make the dynamic array management easier, you can ask the user how many checks and deposits they have to enter. The picture is the .h file for money

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

Write a checkbook balancing program in C++. The program will read in the following information for all checks that were not cashed as of the last time the user balanced their checkbook:

  • the number of each check

  • the amount of the check

  • whether or not the check has yet been cashed

Use a dynamic array with a class base type for the checks.

The check class should have three member variables:

  • check number

  • check amount

  • whether or not the check's been cashed

And don't forget to provide accessors, mutators, and constructors as well as input and output methods.

BTW, the amount member variable will be of type Money. Just save this link to the Money class definition — you do not have to design it yourself!

(A closer look, however, reveals that it is just a class definition... The definitions for the methods seem to be missing. Bummer...)

In addition to all of the checks since the last checkbook update, your program should also read all of the user's deposits, the last balance we reported to them, and the new balance the bank reported to them. You will most likely desire a second [dynamic] array to hold all of the deposits. (A deposit is, of course, a Money type value.)

Your program should calculate and print the total for all checks, the total for all deposits, the calculated new balance, and how much this differs from the reported new balance. (Just in case: the new account balance should be the old balance plus all deposits and minus all cashed checks.)

Then display two lists of checks: those already cashed and those still not cashed. Sort each list from lowest to highest check number. (Note that this will not require you to split the checks into two arrays...)

To make the dynamic array management easier, you can ask the user how many checks and deposits they have to enter.

The picture is the .h file for money.

#ifndef MONEY H
#define MONEY H
#include <iostream>
class Money
{
long all cents;
// monetary value stored as pennies
public:
// Initializes the object to $0.00.
Money (void) ;
// Initializes the object to dollars*100 cents.
Money (long dollars);
// Initializes the object to dollars*100 + cents.
Money (long dollars, short cents);
// Postcondition:
return value is sum of calling object and amount.
neither amount nor calling object are changed.
//
Money add (const Money & amount) const;
// Postcondition:
return value is difference of calling object and amount.
neither amount nor calling object are changed.
//
Money subtract(const Money & amount) const;
// Postcondition:
return value is arithmetic negation of calling object.
calling object is not changed.
//
Money negate (void) const;
// Returns true if the calling object equals the amount, false otherwise.
bool equals(const Money & amount) const;
// Returns true if the calling object is less than the amount,
// false otherwise.
bool less (const Money & amount) const;
// Postcondition:
calling object's value is read from the stream
in normal U.S. format:
//
$ddd.cc.
void input (std::istream & ins);
// Postcondition: calling object's value is printed on the stream
(calling object
//
in normal U.S. format:
is not changed)
$ddd.cc.
void output (std::ostream & outs) const;
// Returns amount of money in decimal format.
double get_value (void) const;
};
#endif
Transcribed Image Text:#ifndef MONEY H #define MONEY H #include <iostream> class Money { long all cents; // monetary value stored as pennies public: // Initializes the object to $0.00. Money (void) ; // Initializes the object to dollars*100 cents. Money (long dollars); // Initializes the object to dollars*100 + cents. Money (long dollars, short cents); // Postcondition: return value is sum of calling object and amount. neither amount nor calling object are changed. // Money add (const Money & amount) const; // Postcondition: return value is difference of calling object and amount. neither amount nor calling object are changed. // Money subtract(const Money & amount) const; // Postcondition: return value is arithmetic negation of calling object. calling object is not changed. // Money negate (void) const; // Returns true if the calling object equals the amount, false otherwise. bool equals(const Money & amount) const; // Returns true if the calling object is less than the amount, // false otherwise. bool less (const Money & amount) const; // Postcondition: calling object's value is read from the stream in normal U.S. format: // $ddd.cc. void input (std::istream & ins); // Postcondition: calling object's value is printed on the stream (calling object // in normal U.S. format: is not changed) $ddd.cc. void output (std::ostream & outs) const; // Returns amount of money in decimal format. double get_value (void) const; }; #endif
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps

Blurred answer
Knowledge Booster
Class
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education