Question: Programming: Handling Exceptions Assignment InstructionsOverviewYou will modify the banking application written in the Programming: Using Inheritance Assignment to throw an error during the data validations

Programming: Handling Exceptions Assignment InstructionsOverviewYou will modify the banking application written in the Programming: Using Inheritance Assignment to throw an error during the data validations in the classes, rather than printing to the screen. This way the main application can decide on how to deal with the error without the application crashing.InstructionsBased on the program you created for the Programming: Using Inheritance Assignment, modify your code to perform the following steps.In the Using Inheritance assignment, you created an Account hierarchy with a base class (Account) and two derived classes (SavingsAccount and CheckingAccount). Three of the mutator methods in this assignment validated user input: setBalance, setInterestRate, and setFeeCharged. In all of these methods, you were instructed to set the respective variables equal to zero if the user passed in a negative amount. In this assignment, you will modify your code such that if the user passes in a negative amount, an exception will be thrown that alerts the user that a negative amount has been entered. The program should catch the exception and display the error message to the user. Once an error (negative amount) has occurred, the program should inform the user that negative numbers are not permitted. It should then redisplay the menu. If an exception has not occurred, and a checking or savings object has been successfully created, the program should print the information for that object.[Hint: You will need to create an exception class call it NegativeNumberException that takes a string as an argument to its constructor that represents the error. The string should be Invalid Entry Negative numbers are not permitted.]Modify your Main() method such that instead of hardcoding the SavingsAccount and CheckingAccount information, you prompt the user to enter the needed information. Generate a menu like the one below and loop until the user enters Q to quit the application.Based on the 18 steps required for the Using Inheritance assignment, you only need to implement steps 1 and 2 and instantiate their creation based on the users menu selections. You may remove steps 3 through 18. This assignment is only intended to demonstrate your ability to handle exceptions.

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!