Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

use NetBeans IDE and show all screenshots each steps: 1.) Build a class called TestExceptions.java. Put the following code in the main method. int myArr

use NetBeans IDE and show all screenshots each steps:

1.) Build a class called TestExceptions.java. Put the following code in the main method. int myArr = new int[10]; int x,y,z; x=0; y=10; z=y/x; myArr[10] = 0; Compile and run this class. What happens? Now add try/catch blocks to catch these exceptions? Is there another way that you can prevent a run-time error without using try-catch blocks?

2.) Next build an Account class. The Account class should have 3 Properties: Balance, Owner and AcctNo. The Account class should have 2 constructors, one that takes all 3 properties and one that takes no args(the default). The Account class should have set and get methods as well as deposit and withdraw methods. Also include a display() method that outputs AcctNo, Owner and Balance. Use a main() method to test out this class. Use the following code, in the main method, to test the Account class? Account a1; a1 = new Account(2222, Frank, 1000); a1.deposit(100.00); a1.display();

3.) Now in your Account main() method, attempt to withdraw more than the current balance that is available. What happens now? Use the following code to test the Account class? Account a1; a1 = new Account(2222, Frank, 500.00); a1.deposit(100.00); a1.withdraw(900.00); a1.display();

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Machine Learning And Knowledge Discovery In Databases European Conference Ecml Pkdd 2010 Barcelona Spain September 2010 Proceedings Part 2 Lnai 6322

Authors: Jose L. Balcazar ,Francesco Bonchi ,Aristides Gionis ,Michele Sebag

2010th Edition

364215882X, 978-3642158827

More Books

Students also viewed these Databases questions

Question

Connect with your audience

Answered: 1 week ago