CPSC1181 MT

Classified in Computers

Written at on English with a size of 1.77 KB.

 
public class Student {
    public Student() {
        name = "No Name";
        address = "Un Known";
    }
    public Student(String inputName) {
        name = inputName;
        address = "Un Known";
    }
    public String getName() {
        return name;
    }
    public void addAddress(String input) {
        address = input;
    }
    public String getAddress() {
        return address;
    }
    public void addCourse(double grade, double credit) {
        gradePoints += grade;
        credits += credit;
        if (credits > 0) {
            aGPA = gradePoints / credits;
        } else {
            aGPA = 0;
        }
    }
    public double getGPA() {
        return aGPA;
    }

    /**
     * Get the loginID of the student.
     * @return a string.
     */
    public String getLoginId() {
        return loginId;
    }

    private String name;
    private double aGPA;
    final int SPACE = 32;
}

Entradas relacionadas: