Question
IN JAVA, create a Person class and 2 objects of this class. you will also display the data from each object. Please deliver: A zipped
IN JAVA, create a Person class and 2 objects of this class. you will also display the data from each object.
Please deliver: A zipped file project with 2 classes: App and Classes.
The Person Class
The attribute are:
-String first name
-String lastname
-string homeTown
- String state.
The APP CLASS: create 2 Person objects call p1 and p2
__p1 data:
firstname = William
lastname= thompson
hometown = houston
state= TX
--p2 data:
firstname = Thomas
lastname = Lang
hometown= columbus
state= SC
1. display the data for each object as specified below:
-If the state attribute is "SC", display the object's attribute name plus the message "is from South Carolina"
-Of the state state attribute is not "SC", display the object's attribute name plus the message "is from out-of-state"
-make sure you display the data using the object p1 and p2:
-> A statement using a fixed string is not a correct answer : System.out.println("William Thompson 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 to handle any variable/object.
Output should be:
William is out-of-state
Thomas is from South Carolina
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