Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

1. Write a C++ class declaration for the following Checkbook ADT (Abstract Data

ID: 3763230 • Letter: 1

Question

1. Write a C++ class declaration for the following Checkbook ADT (Abstract Data Type). Do not implement the ADT other than to include in the private part a concrete data representation for the current balance. All monetary amounts are to be represented as floating-point numbers. Here is the general specifications for the Checkbook ADT that might be useful for declaring the class for use in a program.

TYPE
Checkbook
DOMAIN
Each instance of the Checkbook type is a value representing one customer’s current checking account balance.
OPERATIONS
Open the checking account, specifying an initial balance.
Write a check for a specified amount.
Deposit a specified amount into the checking account.
Return the current balance.
ANSWER:









2. Implement the following Checkbook member functions by writing the class member function procedures outside of the class specification
a. Open
b. WriteCheck
c. MakeDeposit
d. CurrentBalance
ANSWER:

















3. Write a segment of client code that declares two Checkbook objects, one for a personal checkbook and one for a business account.
ANSWER:



4. For the personal checkbook in Question 3, write a segment of client code that opens the account with an initial balance of $300.00, writes two checks $50.25 and $150.00, deposits $87.34 into the account, and prints out the resulting balance.
ANSWER:

Explanation / Answer

Here is the code for you. If you have any further queries, just get back to me.

#include <iostream>
#include <iomanip>
using namespace std;

//1. Class Declaration.
class CheckBook
{
double accountBalance;
public:
   void Open(double bal);
   void WriteCheck(double withdrawAmt);
   void MakeDeposit(double depositAmt);
   double CurrentBalance();
};

//2. Implementation of CheckBook member functions.
void CheckBook::Open(double bal)
   {
   accountBalance = bal;
   }
void CheckBook::WriteCheck(double withdrawAmt)
   {
   if(accountBalance >= withdrawAmt)
   accountBalance -= withdrawAmt;
   }
void CheckBook::MakeDeposit(double depositAmt)
   {
   accountBalance += depositAmt;
   }
double CheckBook::CurrentBalance()
   {
   return accountBalance;
   }
     
//3. Segment of ClientCode. main() function.       
     
int main()
{
CheckBook personalCheckBook, businessAccount;

//4. Opening an account for personalCheckBook with initial balance: $300.00.
personalCheckBook.Open(300.00);
//4. Writing check for $50.25.
personalCheckBook.WriteCheck(50.25);
//4. Writing check for $150.00.
personalCheckBook.WriteCheck(150.00);
//4. Deposit $87.34 into the account.
personalCheckBook.MakeDeposit(87.34);
//4. Printing the resulting balance.
cout<<"The balance in this account is: "<<fixed<<setprecision(2)<<personalCheckBook.CurrentBalance()<<endl;
}   

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote