Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Q 3 . Writing program ( 7 marks ) Define java class Kids that has two private instance variables name and age ( 0 .

Q3. Writing program
(7 marks)
Define java class Kids that has two private instance variables name and age (0.5 mark). Define three overloaded constructor methods with zero argument (receives no name and no age)(0.5 mark ), one argument (receives only name)(0.5 mark ) and two arguments (receives name and age)(0.5 mark).. Additionally, define all sets and gets methods (1 mark).
Define a Java class TestKids that contains a main method and test the functionality of the above class Kids as the following:
Instantiate one object k1 of type Kids using zero argument constructor. (0.5 mark)
Instantiate one object k2 of type Kids using one argument constructor and pass "Omar" as a parameter. (0.5 mark)
Instantiate one object k3 of type Kids using two argument constructor and pass "Anas" as the first parameter and 10 as second parameter. (0.5 mark)
Change the name of object k1 to "Hamza" and the age to 8.(1 mark)
Change the age of the object k2 to 5.(0.5 mark)
Print the names of all kid objects whose age are greater than 6 years old. (1 mark)
image text in transcribed

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_2

Step: 3

blur-text-image_3

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

Upgrading Oracle Databases Oracle Database New Features

Authors: Charles Kim, Gary Gordhamer, Sean Scott

1st Edition

B0BL12WFP6, 979-8359657501

More Books

Students also viewed these Databases questions

Question

b. Did you suppress any of your anger? Explain.

Answered: 1 week ago

Question

Working with other project stakeholders for support.

Answered: 1 week ago

Question

Knowledge of project management (PMI) teachings

Answered: 1 week ago