package cpsc2150.quizzes;

import java.io.*;
import java.util.*;

/**
 * Class that organizes a person's first and last name, and provides a method for printing these.
 *
 * @author Owen Sullivan
 * @version 1.0
 *
 * @invariant [ first and last names are valid ]
 */
public class Person {

    private String firstName;
    private String lastName;

    /**
     * Constructor: sets firstName and lastName according to the parameters.
     *
     * @param first First name
     * @param last Last name
     *
     * @pre [ first and last names are valid ]
     * @post firstName = first AND lastName = last
     */
    public Person(String first, String last) {

        firstName = first;
        lastName = last;

    }

    /**
     * Function to output the first name and last name in the form
     * (with a space separating the two strings): firstName lastName
     *
     * @post [ Output person's name to console ] AND firstName = #firstName AND lastName = #lastName
     */
    public final void print() {

        System.out.println(firstName + " " + lastName);

    }

    /**
     * Function to set firstName and lastName according to the parameters
     *
     * @param first First name
     * @param last Last name
     *
     * @pre [ first and last names are valid ]
     * @post firstName = first AND lastName = last
     */
    public void setName(String first, String last) {

        firstName = first;
        lastName = last;

    }

    /**
     * Function to return the first name
     *
     * @return First name
     *
     * @post getFirstName = firstName AND firstName = #firstName AND lastName = #lastName
     */
    public final String getFirstName() {

        return firstName;

    }

    /**
     * Function to return the last name
     *
     * @return Last name
     *
     * @post getLastName = lastName AND firstName = #firstName AND lastName = #lastName
     */
    public final String getLastName() {

        return lastName;

    }

}