Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Java in NetBeans: 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;

Java in NetBeans:

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? 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(); 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(); What happened? please show screenshots

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

Database And Expert Systems Applications Dexa 2022 Workshops 33rd International Conference Dexa 2022 Vienna Austria August 22 24 2022 In Computer And Information Science 33

Authors: Gabriele Kotsis ,A Min Tjoa ,Ismail Khalil ,Bernhard Moser ,Alfred Taudes ,Atif Mashkoor ,Johannes Sametinger ,Jorge Martinez-Gil ,Florian Sobieczky ,Lukas Fischer ,Rudolf Ramler ,Maqbool Khan ,Gerald Czech

1st Edition

ISBN: 3031143426, 978-3031143427

More Books

Students also viewed these Databases questions

Question

7. Understand the challenges of multilingualism.

Answered: 1 week ago

Question

5. Give examples of variations in contextual rules.

Answered: 1 week ago