Question: Q 3 . Writing program ( 7 marks ) Define java class Kids that has two private instance variables name and age ( 0 .
Q Writing program
marks
Define java class Kids that has two private instance variables name and age mark Define three overloaded constructor methods with zero argument receives no name and no age mark one argument receives only name mark and two arguments receives name and age mark Additionally, define all sets and gets methods 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 k of type Kids using zero argument constructor. mark
Instantiate one object of type Kids using one argument constructor and pass "Omar" as a parameter. mark
Instantiate one object of type Kids using two argument constructor and pass "Anas" as the first parameter and as second parameter. mark
Change the name of object to "Hamza" and the age to mark
Change the age of the object to mark
Print the names of all kid objects whose age are greater than years old. mark
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
