/** * * @author Gene Rohrbaugh * @version 0.5 3/5/2010 */ public class Student { private String name; private int creditsEarned; public Student(String name, int creditsEarned) { super(); this.name = name; this.creditsEarned = creditsEarned; } /** * @return the Student's full name */ public String getName() { return name; } /** * @param name the Student's full name */ public void setName(String name) { this.name = name; } /** * @return number of credits earned */ public int getCreditsEarned() { return creditsEarned; } /** * @param creditsEarned number of credits earned */ public void setCreditsEarned(int creditsEarned) { this.creditsEarned = creditsEarned; } public String toString() { // format Student info as a String and return return "[ " + name + ", " + creditsEarned + " ]"; } /** * Display student as formatted output to console. */ public void display() { // display formatted Student info to console System.out.println(toString()); } public static void main(String[] args) { Student s = new Student("John Doe", 120); s.display(); } }