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

C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN:9781337102087
Author:D. S. Malik
Publisher:D. S. Malik
Chapter10: Classes And Data Abstraction
Section: Chapter Questions
Problem 24PE
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
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning