Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Define a C++ class in a file checking.h with the following declaration: class checking { private: string Name; int AcctNum; char Type double CurrBalance; double

Define a C++ class in a file checking.h with the following declaration:

class checking

{

private:

string Name;

int AcctNum;

char Type

double CurrBalance;

double OverDraftBalance;

double OverDraftLimit;

public:

checking();

void input ();

void deposit (double amount);

void withdraw (double amount);

void updatelimit (double lim);

void updatetype (char type);

void output ();

};

The private data represents checking account information for a bank customer. It contains the customers name, account type, account number, current balance, overdraft balance and overdraft limit.

The public methods (functions) are:

checking : Constructor that sets name to unassigned, type to D the other values to zero.

input: Prompts the user for name, account type, account number, current balance, overdraft balance and overdraft limit and sets the private data values to these user entered values. Checks for a valid type (D, S, P) and valid value for current balance. The current balance cannot be negative nor over 9,999. If any of these error conditions occurs, an error message should be outputted and no values should be set.

deposit: Increases the checking accounts current balance by the given amount. The amount cannot be negative nor over 9,999. If the deposit amount is negative or over 9,999, an error message should be outputted and the current balance not changed.

withdraw : Decreases the checking accounts current balance by the given amount. If the decrease causes the checking accounts current balance to become negative, then add the absolute amount below zero to the overdraft balance. If the overdraft balance is greater than the overdraft limit, output an error message and reset the current balance and the overdraft balance to their original values. If the inputted withdrawal amount is negative or over 9,999, an error message should be outputted and the current balance not changed.

Example 1 :

Before : After:

Withdrawal amount = $150

Current balance = $100 Current balance = $0

Overdraft balance = $50 Overdraft balance = $100

Overdraft limit = $250 Overdraft limit = $250

Example 2 :

Before : After:

Withdrawal amount = $300

Current balance = $100 Current balance = $100

Overdraft balance = $150 Overdraft balance = $150

Overdraft limit = $250 Overdraft limit = $250

In this case, the message Overdraft Limit exceeded appears and the values do not change.

updatelimit: Replace the overdraft limit with the given amount. If the given amount is negative or over 2000, an error message should be outputted and the values not changed.

updatetype: Replace the type with the given value. If the given value is not equal to D or S or P, an error message should be outputted and the values not changed.

output: Output the checking account information in the format shown below.

It also computes and outputs the deposit overdraft ratio (DOR) using the following formula :

DOR = OverDraftBalance/CurrBalance X

(OverDraftBalance/OverDraftLimit)

The DOR should be outputted with two places after the decimal followed by the % sign. See the example for the format the output should follow.

Write the program that utilizes the checking object. It should be menu driven with choices for inputting a checking accounts data, deposits, withdrawals, updating the overdraft limit, updating the account type, outputting the accounts information

and quitting. Your program should follow the formatting given by the following example (input shown in bold). Note: there are a number of choices and error conditions not shown in this example. You should test all of these before handing in your program.

Enter one of the following:

e: Enter checking account information

d: Make deposit

w: Make withdrawal

l: Update overdraft limit

t: Update account type

o: Output account information

q: Quit the program

Command: o

Acct number : 0000 Name: unassigned

Acct Type : D

Curr Bal : $ 0.00

Overdraft Limit $ 0.00

Overdraft Bal : $ 0.00

Deposit/OD ratio : 0.00 %

Enter one of the following:

e: Enter checking account information

d: Make deposit

w: Make withdrawal

l: Update overdraft limit

t: Update account type

o: Output account information

q: Quit the program

Command: e

Enter name: Meyers

Enter Account Number : 4812

Enter Account Type : S

Enter Balance $ : 1500.00

Enter OD Limit $ : 500.00

Enter OD Balance $ : 303.00

Enter one of the following:

e: Enter checking account information

d: Make deposit

w: Make withdrawal

l: Update overdraft limit

t: Update account type

o: Output account information

q: Quit the program

Command: o

Acct number : 4812 Name: Meyers

Acct Type : S

Curr Bal : $ 1500.00

Overdraft Limit $ 500.00

Overdraft Bal : $ 303.00

Deposit/OD ratio : 0.12 %

Enter one of the following:

e: Enter checking account information

d: Make deposit

w: Make withdrawal

l: Update overdraft limit

t: Update account type

o: Output account information

q: Quit the program

Command: d

Enter deposit amount $ : 250

Enter one of the following:

e: Enter checking account information

d: Make deposit

w: Make withdrawal

l: Update overdraft limit

t: Update account type

o: Output account information

q: Quit the program

Command: w

Enter withdrawal amount $ : 100

Enter one of the following:

e: Enter checking account information

d: Make deposit

w: Make withdrawal

l: Update overdraft limit

t: Update account type

o: Output account information

q: Quit the program

Command: l

Invalid entry, please try again!

Enter one of the following:

e: Enter checking account information

d: Make deposit

w: Make withdrawal

l: Update overdraft limit

t: Update account type

o: Output account information

q: Quit the program

Command: o

Acct number : 4812 Name: Meyers

Acct Type : S

Curr Bal : $ 1650.00

Overdraft Limit $ 500.00

Overdraft Bal : $ 303.00

Deposit/OD ratio : 0.11 %

Enter one of the following:

e: Enter checking account information

d: Make deposit

w: Make withdrawal

l: Update overdraft limit

t: Update account type

o: Output account information

q: Quit the program

Command: d

Enter deposit amount $ : -750

Deposit amount must be positive!

Enter one of the following:

e: Enter checking account information

d: Make deposit

w: Make withdrawal

l: Update overdraft limit

t: Update account type

o: Output account information

q: Quit the program

Command: e

Enter name: Wilson

Enter Account Number : 1125

Enter Account Type : P

Enter Balance $ : -123.00

Enter OD Limit $ : 200.00

Enter OD Balance $ : 3.00

Illegal data entry! You'll need to try again!

Enter one of the following:

e: Enter checking account information

d: Make deposit

w: Make withdrawal

l: Update overdraft limit

t: Update account type

o: Output account information

q: Quit the program

Command: o

Acct number : 4812 Name: Meyers

Acct Type : S

Curr Bal : $ 1650.00

Overdraft Limit $ 500.00

Overdraft Bal : $ 303.00

Deposit/OD ratio : 0.11 %

Enter one of the following:

e: Enter checking account information

d: Make deposit

w: Make withdrawal

l: Update overdraft limit

t: Update account type

o: Output account information

q: Quit the program

Command: q

Program ended.

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

Step: 3

blur-text-image

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

Advances In Spatial And Temporal Databases 11th International Symposium Sstd 2009 Aalborg Denmark July 8 10 2009 Proceedings Lncs 5644

Authors: Nikos Mamoulis ,Thomas Seidl ,Kristian Torp ,Ira Assent

2009th Edition

3642029817, 978-3642029813

More Books

Students also viewed these Databases questions

Question

fscanf retums a special value EOF that stands for...

Answered: 1 week ago

Question

Discuss the history of human resource management (HRM).

Answered: 1 week ago