Question: I need help with this C++ problem: create an exception class and use try / catch structure to handle the exceptions thrown from the withdraw

I need help with this C++ problem:

create an exception class and use try / catch structure to handle the exceptions thrown from the withdraw and deposit transactions of a bank account. Here are sample inputs / outputs;

--------------------------------------------------

Enter Customer Name: John Clark

Account Number: 0001

Account Name: John Clark

Account Balance: $0.00

How Much Money To Deposit? 4000

Account Number: 0001

Account Name: John Clark

Account Balance: $4000.00

How Much Money To Withdrawn? 1000

Account Number: 0001

Account Name: John Clark

Account Balance: $3000.00

--------------------------------------------------

Use the exceptions for errors of deposit or withdrawal with the following output:

For deposit such as -100:

"Invalid deposit transaction."

For withdrawal such as -100 or a number over the current amount in the account:

"Invalid withdraw transaction."

Declare and implement an accountException.h to represent the account transaction exceptions. This should include --

- Data member called message of the account transaction exception.

- Default null constructor that assigns your message to the data member message

- Constructor with a string parameter that passes a message as a parameter and assigns it to the data member message

- Function what () return the message.

Declare and implement class account including the following members

Data member:

- account number

- account name

- balance

Member functions:

- constructor with parameters

- withdraw(double)

- throw accountException for invalid withdraw transactions.

- perform withdraw transaction for valid amount of money

- deposit(double)

- throw accountException for invalid deposit transactions.

- perform deposit transaction for valid amount of money.

- displayAccount() display account number, name and balance.

Define tester (driver) program

- Ask user to enter customer name

- Use customer name, default account number (0001) and default balance (0.0) to create account object.

- Implement object-oriented programming and call the withdraw and deposit functions.

- Define try / catch structure to handle the accountException thrown by the withdraw and deposit functions.

I need help with this C++ problem: create an exception class and

Please include all the code, thank you!

Here is an example of your tester program

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!