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

  Graph a pair of intersecting lines

(a) Is the system inconsistent, or are the equations dependent, or neither? (b) Is the graph a pair of intersecting lines, a pair of parallellines, or one line? (c) Does the system have onesolution, nosolution, or an infinite number of solutions?

  Does either prim''s or kruskal''s algorithm work

Consider the collection of edges selected by Dijkstra's algorithm as the shortest paths to the graph's vertices from the start vertex. Do these edges form a spanning tree (not necessarily of minimum cost)? Do these edges form an MST? Explain why o..

  Construct an xml document having two multivalue paths

What is the importance of the order of tables in an SQL statement that uses FOR XML? When would you use FOR XML EXPLICIT? Explain, in your own words, why SQL with FOR XML cannot be used to construct an XML document having two multivalue paths.

  Improvements to previous windows version

What Windows 7, Windows 8 or Windows 10 (depending on what OS YOU CURRENTLY have installed on your computer) features are improvements to previous Windows version? What about compared to other OS's like Mac and UNIX?

  Name three industrial applications of visualization

Name three industrial applications of visualization. Name the specifi c techniques used and the perceptual cues they exploit.

  Database administrator to define schema components

I solemnly affirm, acknowledge and certify that my responses to this examination were completed without any contact with other persons during or before the examination.

  Magnitude of the velocity of the particle

Find the magnitude of the velocity of the particle for the specific value of t.The magnitude is approximately nothing.(Type an integer or decimal rounded to two decimal places as needed.)

  Sources to a statistical multiplexer that transmits

Question 1 Suppose that packets arrive from various sources to a statistical multiplexer that transmits the packets over a 64 kbps PPP link. Suppose that the PPP frames have lengths that follow an exponential distribution with mean 1000 bytes and ..

  Would the acquisition strategy affect your role

As a systems analyst, what would your role be in helping Sandy Shores develop a new system? Would the acquisition strategy affect your role? Why or why not?

  The external services installations

The suggested word limit for the main body of the report is 3,000 for guidance (Excluding Abstract, Conclusion, Appendices, References & Bibliography). For section (1) You need to consider for each component part of construction chosen: Elements ..

  Provide the sql statement below

Create a new query to display all authors with last name of "Smith" and all books by this author. Show author id, author first name, author last name, title id, and title. Group data by title id. Provide the SQL statement below:

  How a non-it senior manager would arrive at the decision

How a non-IT senior manager would arrive at the decision to support one IT diffusion model over another. List the factors that would have to be considered. Determine which model you would choose and explain why.

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