Program #7 student file

Program #7 student file - public int getIdNum() { // Return...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
Sheet1 Page 1 // Matt Hergenrether // Section 10 // CS 1113 // April 14, 2008 // Program 7 // gets names, id numbers, gpa's and year import java.util.* import java.text.DecimalFormat public class Student { private static DecimalFormat twoDecPl = new DecimalFormat("0.00") //class variables private String name private int idNum private double gpa private String year // Constructor public Student(String namePar, int idNumPar, double gpaPar, String yearPar) { name = namePar idNum = idNumPar gpa = gpaPar year = yearPar } // Accessor: returns name of student public String getName() { // Return the name of the student return name } // Accessor: returns GPA of student public double getGPA() { // Return the gpa of the student return gpa } // Accessor: returns idNum of student
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Background image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: public int getIdNum() { // Return the idnum of the Student Sheet1 Page 2 return idNum } //Accessor: returns year of student public String getYear() { // Return the year of hte student return year } // Mutator: Changes the GPA of the student public void setGPA(double g) { // Set the class variable gpa equal to g gpa = g } // Mutator: Changes the year of the student public void setYear(String y) { year = y } public String toString() { String value = "\n" + "Student info:" value = "\n" + " Name : " + name value = value + "\n" + " idNum: " + idNum value = value + "\n" + " GPA : " + gpa value = value + "\n" + " Year : " + year return value } }...
View Full Document

This note was uploaded on 09/28/2011 for the course CS 1113 taught by Professor Chandler during the Fall '08 term at Oklahoma State.

Page1 / 2

Program #7 student file - public int getIdNum() { // Return...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online