Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Java Object-Oriented Programming Short Questions 4. (20 marks) Based on what we have learnt in our course with our questions. Suppose we are given a

Java Object-Oriented Programming Short Questionsimage text in transcribedimage text in transcribed

4. (20 marks) Based on what we have learnt in our course with our questions. Suppose we are given a class ETAClass. This given class has a class method someMethod() which accepts no input argument and returns no value, but potentially produces exception of a "special exception type SomeException back to the caller. Ignore the details of what this class and method actually do. Answer the coming questions. a) Write a public class WONGvg (named related to your surname) in Java for averaging numbers, so that the following program codes could be run as expected with this new class. (Use your own surname, suppose the student surname is WONG in the example program code below) o Body of all constructors and methods can have no more than 2 statements. Execution of the codes below would display on console the average result: 5.5 WONGvg ETA = new WONGavg(); WONGvg bETA = new WONGvg (2.2, 8.8); ETA.setAvg ( DETA); System.out.println( aETA.getAvg() ); [10 marks) o o 0 o (* Suppose exception type Number Format Exception) Sample Console Display Output Copa Coo Ae -20210 [10 marks/

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

Visual Basic 4 Ole Database And Controls Superbible

Authors: Michael Hatmaker, C. Woody Butler, Ibrahim Malluf, Bill Potter

1st Edition

1571690077, 978-1571690074

More Books

Students also viewed these Databases questions

Question

What magazine and ads did you choose to examine?

Answered: 1 week ago