Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Please do not use this code or anything similar. Person.java: public class Person { private String firstName; private String lastName; private String hometown; private String
Please do not use this code or anything similar.
Person.java:
public class Person {
private String firstName;
private String lastName;
private String hometown;
private String state;
public Person(String firstName, String lastName, String hometown, String state) {
this.firstName = firstName;
this.lastName = lastName;
this.hometown = hometown;
this.state = state;
}
public String getFirstName() {
return firstName;
}
public String getLastName() {
return lastName;
}
public String getHometown() {
return hometown;
}
In this lab you will create a Person class and 2 objects of this class. You will also display the data from each object. Deliverable A zipped NetBeans project with 2 classes App - Person Classes The Person Class The attributes - String firstName - String lastName - String hometown - String state The App class Create 2 Person objects called p1 and p2. - p1 data: firstName - Jillian lastName - Jennings hometown - Montclair state - NJ - p2 data: firstName - Keaton lastName - Ellis hometown - State College state - PA 1. display the the data for each object as specified below: - 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" - make sure you display the data using the objects p1 and p2 - A statement using a fixed string is not a correct answer - System.out.println("Jillian is out-of-state"); is not the answer - looking at the data and having specific "system.out" is not the correct answer - You need to use if statements (or other kind of tests) to handle any variable/object
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