Complete and fully test the class Person that Exercise 10 describes. Include the following additional methods.
• getName—returns the name of the person as a string.
• getAge—returns the age of the person.
• setName(first, last)—sets the name of the person, given a first and last
name as strings.
• setName(name)—sets the name of the person, given the entire name as one string.
• setAge(age)—sets the age of the person.
• createToddler—a static method that returns a special instance of the class
to represent a toddler. The instance has the name “A toddler” and the age 2.
• createPreschooler—a static method that returns a special instance of the
class to represent a preschooler. The instance has the name “A preschooler”
and the age 5.
• createAdolescent—a static method that returns a special instance of the
class to represent an adolescent. The instance has the name “An adolescent”
and the age 9.
• createTeenager—a static method that returns a special instance of the class to represent a teenager. The instance has the name “A teenager” and the age 15.
This project demonstrates a class that uses static methods to create special instances of the class. Test cases are in the main method
See the code in Person.java.
You might also like to view...
A queue is a __________ data structure.
a. FOFI. b. FIFO. c. OFIF. d. IFOF.
Check Disk, Optimize Drives, and Disk Cleanup are all types of ________
A) file systems B) hotfixes C) disk-checking utilities D) backup utilities
A combo box allows users to select from a list of choices that displays in a drop-down box, but the user can also modify the choices in the list
Indicate whether the statement is true or false
What is design thinking?
What will be an ideal response?