Write a checkbook balancing program. 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 checkclass 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. Also if any library definitions are used, please show them. Here is the money class definition that should be used: // This is the HEADER FILE money.h. This is the INTERFACE for the class // Money. Values of this type are amounts of money in U.S. currency. #ifndef MONEY_H #define MONEY_H #include 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 // in normal U.S. format: $ddd.cc. (calling object // is not changed) void output(std::ostream & outs) const; // Returns amount of money in decimal format. double get_value(void) const; }; #endif

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. 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 checkclass 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. Also if any library definitions are used, please show them.

Here is the money class definition that should be used:

// This is the HEADER FILE money.h. This is the INTERFACE for the class

// Money. Values of this type are amounts of money in U.S. currency.

#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 // in normal U.S. format: $ddd.cc. (calling object // is not changed)

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
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