Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started