Question: 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

Define java class Kids that has two private instance variables name and 

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 (I 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 kl 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 kl 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. (I mark)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

Heres the implementation in Java java class Kids private String name private int age Constructors pu... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!