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

  What are five types of knowledge produced from data mining

What are association rules as a type of knowledge? Give a definition of support and confidence and use them to define an association rule.

  Why is the pcm sampling time

Radio Antennas work best when the diameter of the antenna is equal to the wave length of the radio wave. Reasonable antennas range from 1 cm to 5 meters in diameter. What frequency range does this cover?

  Find the exact value of the indicated trigonometric function

In the problem, sin θ and cos θ are given. Find the exact value of the indicated trigonometric function. sin θ = 1/4, cos θ = (sqrt15)/4 Find csc θ.

  Compare time complexity-convolution using direct convolution

Compare time complexity of convolution with n x n kernel when using: direct convolution with 2-D mask, and separable kernel.

  Whats the difference between mongodb collection and a table

What's the difference between MongoDB collection and a table in a relational database. Show the differences as it pertains to create a collection and also displaying the data.

  List out some ways to improve the interaction design

List out some ways to improve the interaction design of the poor web site.(must be at least 70 words long)

  Compare and contrast virtual teams and traditional teams

Compare and contrast virtual teams and traditional teams

  The company uses several factors to set discounts

The company uses several factors to set discounts, as follows: A student who has taken a safe driver course earns a 5% discount A student with a clean record (no tickets or accidents in the last three years) earns a 5% discount

  Implementing customer needs into functional design

Quality Function Deployment (QFD) is a means for implementing customer needs into functional design. The mission of ABC Audio LLC is to deliver highperforming, rugged and reliable quality audio products to its customers.

  Design a simple site to showcase a few products

Allow for customer to choose delivery options. One of those options is having the item shipped directly to the customer.

  Which risk handling options are being used

A company is handling its high R&D financial risk by taking on partners and hiring subcontractors. The partners/subcontractors are expected to invest some of their own funds in the R&D effort in exchange for sole-source, long-term production contr..

  Describe what each of the two-dimensional characters

Describe what each of the two-dimensional characters might represent and the data that would be held in the array. Also, provide an example array declaration.

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