Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

answer question use object oriented programmng in java. please provide explanation for the answer. QUESTION 2 Consider the following test class, Testclassi. public class TestClassi

answer question use object oriented programmng in java.

please provide explanation for the answer.

image text in transcribed

QUESTION 2 Consider the following test class, Testclassi. public class TestClassi public static void main(String[] args) int x = 6; Class1 cl - new classi(x); cl.disp(); // n = 6 cl.setN(-5); System.out.println(cl); // n = -5 if (cl.is Negodd()) System.out.println(cl.get()+": a negative odd integer"); else System.out.println(el.getN()+":not a negative odd integer"); // -5:a negative odd integer } a) State the category of the methods below: i. setN() ii. isNegodd () iii. disp) iv. getN) (2 marks) b) Write a method definition of isNegodd(). (3 marks) c) Write a toString() method to produce the same output as disp(). (3 marks) d) Write a complete class implementation of class1. (7 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

Database And Transaction Processing

Authors: Philip M. Lewis, Arthur Bernstein, Michael Kifer

1st Edition

0201708728, 978-0201708721

More Books

Students also viewed these Databases questions