For this assignment you are going to write code for the following ONE class.
This class has instance variables AND methods.
Person must have 2 public INSTANCE variables.
setFirstName
returns: nothing
arguments: 1 String
what it does: it assigns its argument to the variable fName
The following code example shows how this method would be used. This is NOT the code you have to write:
// if pp is a variable that contains a reference to Person, then:
pp.setFirstName("jon");// the argument is the String "jon"
System.out.println(pp.fName); // prints "jon"
another example:
pp.setFirstName("mary");//the argument in this case is the String "mary"
System.out.println(pp.fName); // prints "mary"
setLastName
returns: nothing
arguments: 1 String
what it does: it assigns its argument to the variable lName
Example:
// if pp is a variable that contains a reference to Person, then:
pp.setLastName("foo");//the argument in this case is the String "foo"
System.out.println(pp.lName);//prints "foo"
another example:
pp.setLastName("doe");
System.out.println(pp.lName);//this time this statement prints "doe"
getFirstName
returns: String
arguments: none
what it does: it returns the value of variable fName
Example:
// if pp is a variable that contains a reference to Person, then:
//next statment assigns a value to variable fName
pp.setFirstName("mary");//notice that getFirstName in the next statement has no argument
//next statement prints the current value of varuable fName
System.out.println(pp.getFirstName()); // prints "mary"
getLastName
returns: String
arguments: none
what it does: it returns the value of variable lName
Example:
pp.setLastName("smith");
System.out.println(pp.getLastName()); // prints "smith"