Java Reference
In-Depth Information
LISTING 8.6
//********************************************************************
// Grade.java Author: Lewis/Loftus
//
// Represents a school grade.
//********************************************************************
public class Grade
{
private String name;
private int lowerBound;
//-----------------------------------------------------------------
// Constructor: Sets up this Grade object with the specified
// grade name and numeric lower bound.
//-----------------------------------------------------------------
public Grade (String grade, int cutoff)
{
name = grade;
lowerBound = cutoff;
}
//-----------------------------------------------------------------
// Returns a string representation of this grade.
//-----------------------------------------------------------------
public String toString()
{
return name + "\t" + lowerBound;
}
//-----------------------------------------------------------------
// Name mutator.
//-----------------------------------------------------------------
public void setName (String grade)
{
name = grade;
}
//-----------------------------------------------------------------
// Lower bound mutator.
//-----------------------------------------------------------------
public void setLowerBound ( int cutoff)
{
lowerBound = cutoff;
}
Search WWH ::




Custom Search