The world’s Largest Sharp Brain Virtual Experts Marketplace Just a click Away
Levels Tought:
Elementary,Middle School,High School,College,University,PHD
| Teaching Since: | Jul 2017 |
| Last Sign in: | 304 Weeks Ago, 3 Days Ago |
| Questions Answered: | 15833 |
| Tutorials Posted: | 15827 |
MBA,PHD, Juris Doctor
Strayer,Devery,Harvard University
Mar-1995 - Mar-2002
Manager Planning
WalMart
Mar-2001 - Feb-2009
C&O: Person
You have been provided with a class Person, it contains the following attributes: name (String), address (String), and a unique pps number (int). Provided in the class is getter and setter methods for each attribute, and a showPerson() method that will print all the details about a Person to the screen.Â
Â
Add a toString() that returns a string representation of the attributes of a Person (see sample output below for format).
Write a main method in a new class called TestPerson.java and in this method:
i). Declare an array of 3 Person objects. Instantiate each of the Person objects by obtaining the necessary attribute values from a user through keyboard input.
ii). Call the getName(), getAddress() and getPPSNo() methods to print the information of the first person to the screen (it should be displayed exactly as the sample output below).
iii). Call the setName(<…>) and setAddress(<…>) method to change the information on the second Person.
iv). Use a ‘for’ loop and the showPerson() method to print all the information for all People to the screen (it should be displayed exactly as the sample output below).
v). Call the toString() method on the 3rd Person object in the array.
Input:
n, where n is any String value  Â
Sample input:
Bob Hope Â
Output:
The TestPerson class should print to the screen the correct message to match each question given above.
Sample output:
Person 1 is called Bob Hope
They live in America
Their PPS Number is 1001.0
*****PERSONAL DETAILS*****
NAME: Bob Hope
ADDRESS: America
PPS NUMBER: 1001
*****PERSONAL DETAILS*****
NAME: Paul Smyth
ADDRESS: Dublin
PPS NUMBER: 1002
*****PERSONAL DETAILS*****
NAME: Mary Murphy
ADDRESS: Mayo
PPS NUMBER: 1003
NAME: Mary Murphy
ADDRESS: Mayo
PPS NUMBER: 1003
----------- Â ----------- H-----------ell-----------o S-----------ir/-----------Mad-----------am ----------- Th-----------ank----------- yo-----------u f-----------or -----------you-----------r i-----------nte-----------res-----------t a-----------nd -----------buy-----------ing----------- my----------- po-----------ste-----------d s-----------olu-----------tio-----------n. -----------Ple-----------ase----------- pi-----------ng -----------me -----------on -----------cha-----------t I----------- am----------- on-----------lin-----------e o-----------r i-----------nbo-----------x m-----------e a----------- me-----------ssa-----------ge -----------I w-----------ill----------- be----------- qu-----------ick-----------ly