Created
May 27, 2013 10:10
-
-
Save srialdabaoth/5656319 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* | |
| * To change this template, choose Tools | Templates | |
| * and open the template in the editor. | |
| */ | |
| package collegelist; | |
| public class Person { | |
| private String firstName, lastName, streetAddress; | |
| private int postCode, phoneNumber; | |
| //Construct a default person | |
| public Person(){ | |
| } | |
| //Construct a default Person with specified values | |
| public Person(String firstName, String lastName, String streetAddress, | |
| int postCode, int phoneNumber, String[] variables){ | |
| this.firstName = firstName; | |
| this.lastName = lastName; | |
| this.streetAddress = streetAddress ; | |
| this.postCode = postCode; | |
| this.phoneNumber = phoneNumber; | |
| } | |
| //Return frstName | |
| public String getFirstName(String firstName){ | |
| return firstName; | |
| } | |
| //Set first name | |
| public void setFirstName(String firstName){ | |
| this.firstName = firstName; | |
| } | |
| //Return Last name | |
| public String getLastName(String lastName){ | |
| return lastName; | |
| } | |
| //Set last name | |
| public void setLastName(String lastName){ | |
| this.lastName = lastName; | |
| } | |
| //Return street address | |
| public String getStreetAddress(String streetAddress){ | |
| return streetAddress; | |
| } | |
| //Set street address | |
| public void setStreetAddress(String streetAddress){ | |
| this.streetAddress = streetAddress ; | |
| } | |
| //Return post code | |
| public int getPostCode(int postCode){ | |
| return postCode; | |
| } | |
| //Set post code | |
| public void setPostCode(int postCode){ | |
| this.postCode = postCode; | |
| } | |
| //Return phone number | |
| public int getPhoneNumber(int phoneNumber){ | |
| return phoneNumber; | |
| } | |
| //Set phone number | |
| public void setPhoneNumber(int phoneNumber){ | |
| this.phoneNumber = phoneNumber; | |
| } | |
| public String[] variables(){ | |
| String[] variables = new String[]{ | |
| "first name", | |
| "last name", | |
| "street address", | |
| "postcode", | |
| "phone number"}; | |
| return variables; | |
| } | |
| //Print Person info | |
| public void displayInfo(String[] person){ | |
| System.out.println("First name: \t\t" + firstName); | |
| System.out.println("Last name: \t\t" + lastName); | |
| System.out.println("Street Address: \t\t" + streetAddress); | |
| System.out.println("Postcode: \t\t" + postCode); | |
| System.out.println("Phone Number: \t\t" + phoneNumber); | |
| } | |
| //User entered data | |
| public void userEntry(String[] person){ | |
| for (int i = 0; i < person.length; i++){ | |
| System.out.println("Enter " + person[i] + " :"); | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment