Question: Please use new code Objects as Parameters In this lab you will create and use methods (that use Objects as Parameters) in the Person class.
Please use new code


Objects as Parameters In this lab you will create and use methods (that use Objects as Parameters) in the Person class. Deliverable A zipped NetBeans project with 3 classes - App - Person - Height Classes Suggestion: - Use Netbeans to copy your last lab (Lab 03) to a new project called Lab04. - Close Lab03. - Work on the new Lab04 project then. The Person Class 1. Attributes - String firstName - String lastName - Height height - String hometown - String state 2. Constructors - one constructor with no input parameters - since it doesn't receive any input values, you need to use the default values below: - firstName - No - lastName - Name - height - use the Height class no-parameter constructor - hometown - N/A - state-N/A - one constructor with three parameters. - firstName using the input parameter - lastName using the input parameter - height using the input parameter - use the default values for - hometown - N/A - state-N/A - one constructor with all (five) parameters - one input parameter for each attribute 3. Methods - public String toString() - returns this object as a String, i.e., make each attribute a String, concatenate all strings and return as one String. - toString0 is a special method, you will leam more about it in the next lessons - it needs to be public - it needs to have @override notation (on the line above the method itself). Netbeans will suggest you do it. - regarding state, the tostring method will have a similar functionality as App had in the first lab. - if the state attribute is "PA". display the object's attribute name plus the message "is from Pennsylvania" - if the state attribute is not "PA", display the object's attribute name plus the message "is from out-of-state" - In short, the toString(l method retums all the data from each object as a String The Height class 1. Attributes - int feet - int inches 2. Constructors - one constructor with no input parameters - since it doesn't receive any input values, you need to use the default values below: - feet 5 - inches-6 - one constructor with two parameters - feet using the input parameter - inches using the input parameter 3. Methods - String tostring() - toString() overrides the superclass Object toString(\} method - toString() returns information about this class attributes as a String - it returns a formatted String with feet and inches - for instance: 5 The App class - create a Person object called p1 using the five-parameter constructor with the values - firstName - Jillian - lastName-Jennings - height 57 - hometown-Montclair - state-NJ 2. create a Person object called p2 using the three-parameter constructor with the value - firstName - Keaton - lastName-Ellis - height 511 3. create a Person object called p3 using the no-parameter constructor 4. display all the data from each object Output The output should be similar to Person (firstNane-Jilian, lastWame-Jennings, hometown-Montclair, state-cut-of-state, height-Height {5}}} PersonffirstNane-Keaton, lastNane-Ellis, horetown-N/A, state-N/A, hoight-Height {511}} PersonffirstNane-No, lastNanc-Nanc, honctown-N/A, stste-N/A, height-Height {56}}
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
