Create a bankaccountexception class

Assignment Help Basic Computer Science
Reference no: EM131396040

You have been developing a BankAccount class for Parkville Bank that contains several fields and functions, including overloaded operators. You have also created child classes derived from the BankAccount class:
CheckingAccount, SavingsAccount, and CheckingWithInterest. Complete these tasks:

a. Create a BankAccountException class. The class contains a BankAccount object and a string message explaining the reason for the exception. Include a constructor that requires values for the BankAccount and the message. Also include a function that displays the message.

b. Modify each BankAccount class constructor and data entry function so that it throws an exception whenever a client attempts to instantiate a BankAccount with an account number that is less than 1000 or greater than 9999.

c. Write a main()function that asks the user to enter values for four BankAccounts. If the user attempts to create a BankAccount with an invalid account number, catch the exception, display a message, and force the account number and balance to 0. Display the four BankAccount objects. Save the file as BankException1.cpp.

d. Write a main()function that declares an array of four CheckingAccounts. (The CheckingAccount constructor calls the BankAccount data entry function, so an exception might be thrown.) If the user attempts to create a CheckingAccount with an invalid account number, catch the exception, and, before ending the program, display two messages. The first message is the string message contained in the BankAccountException object. The second indicates which CheckingAccount (1, 2, 3, or 4) caused the early termination. If all four CheckingAccounts are valid, then display them. Save the file as BankException2.cpp.

e. Alter the SavingsAccount constructor to make sure an exception is thrown when the account number is invalid (based on the same rules for a BankAccount account number) and also when the interest rate is negative. (Make sure the messages are different.) Write a main()function that declares an array of four SavingsAccounts. If the user attempts to create a SavingsAccount with an invalid account number or a negative interest rate, catch the exception, display the appropriate message, and display which account caused the early termination (1, 2, 3, or 4). If all four SavingsAccounts are valid, then display them. Save the file as BankException3.cpp.

Reference no: EM131396040

Questions Cloud

Create a fractionexception class : Create a FractionException class. The class contains a Fraction object and a string message explaining the reason for the exception. Include a constructor that requires values for the Fraction and the message. Also include a function that displays..
Perform a mann whitney u test and write a conclusion : Suppose your friend in given problem arranged for three more cars, labeled the 9 cars A-I, changed a to .05, and conducted the "quiet" test. The results are shown in the accompanying table. Perform a Mann-Whitney U test and write a conclusion.
Write a report on network design and management trends : You will research and report on network design and management trends over the last three years (present year minus 2) in the areas of virtualization and security.
My grandmothers dumpling : Which kind of process is this essay? In other words, what is the author's purpose: Could a reader recreate the dumplings based on reading this? Or is the writer describing the process?
Create a bankaccountexception class : Modify each BankAccount class constructor and data entry function so that it throws an exception whenever a client attempts to instantiate a BankAccount with an account number that is less than 1000 or greater than 9999.
What is the issue that article is specifically addressing : Articles are written to inform, misinform, influence, or misdirect, among other reasons. Sometimes they serve as nothing more than a vehicle for an author to achieve fame, notoriety, and wealth. You should never take at face value the elements o..
What are the advantages of complex routing algorithms : Complex routing algorithms are used to maintain routing tables. What algorithms are used, and how do they work? What are the advantages and disadvantages of each? Which ones are most commonly used in today's networks?
What are the advantages of complex routing algorithms : Complex routing algorithms are used to maintain routing tables. What algorithms are used, and how do they work? What are the advantages and disadvantages of each? Which ones are most commonly used in today's networks?
Present the problem that needs to be addressed : Provide a concluding paragraph that summarizes the stated problems and promises a solution - Develop a coherently structured paper with an introduction, body, and conclusion.

Reviews

Write a Review

Basic Computer Science Questions & Answers

  Develop an alternative to the biofilm detachment model

Run the simulation long enough to observe the pores gradually filling and formation of a compact biofilm.

  Question regarding the business law analysis

In the basic negligence rule that everyone must take "reasonable care" to avoid injury to others, reasonable care can vary with time and place and with the relationship between people, so that the same conduct might be considered negligent in one ..

  Write an expression that refers to the first element

Given an ArrayList a , write an expression that refers to the first element of the ArrayList.

  Define group of each of the following multicast addresses

Define the group of each of the following multicast addresses (local network control block, internetwork control block, SSM block, Glop block, or administratively scoped block)

  Exploration paper on software engineering

An exploration paper on software engineering. You can discover the code on any parts of software engineering, in any event the code can't be excessively straightforward. The following are the particular prerequisites. Be that as it may, be careful..

  What is the total number of available memory locations

The owner's manual for a small microcomputer states that the computer has usable memory location at the following hex addresses: 0200 through 03FF, and 4000 through 7FD0. What is the total number of available memory locations?

  Problem regarding the expectancy theory

According to expectancy theory, what can a manager do to increase an employee's motivation? Does his or her culture make a difference?

  What should we look for in a candidate threshold value

When scanning the normalized histogram of mean propensity values, what should we look for in a candidate threshold value?

  Organize the presentation so that the information is clear

Organize the presentation so that the information is clear and visually appealing.

  Losing sight of underlying consumer needs

Q1. ________ refers to sellers being preoccupied with their own products and losing sight of underlying consumer needs.

  Write a program that simulates an automatic teller machine

Design your interface to be similar to what you see on your local ATM. The user account information should be stored in a file when the program terminates. This file is read in again when the program restarts.

  Number of cpu processing cycles

Taking into account the availability of today's powerful computers, why is programming efficiency important? Consider how the number of lines of programming instructions impact the number of CPU processing cycles?

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd