Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 2

package com.Hirro.

domain;

public class Student


{
private String name;
private String course;
private int studentNumber;

//constructor
public Student(String n, String c, int s)
{
setName(n);
setCourse(c);
setStudentNumber(s);
}

//setters
public void setName(String n)
{
if(n == null)
name = "noValue";
else
name = n;
}
public void setCourse(String c)
{
if(c == null)
course ="noValue";
else
course = c;
}
public void setStudentNumber(int s)
{
if (s >= 0)
studentNumber = s;
else
studentNumber = 0;
}

//getters
public String getName()
{
return name;
}
public String getCourse()
{
return course;
}
public int getStudentNumber()
{
return studentNumber;
}

public String showDetails()


{
return (getName() + " [Student Number "
+ getStudentNumber() + "] is taking up " + getCourse()) +
" at the University of Santo Tomas.";
}

You might also like