2. Please construct a class in terms of the below description. (5 marks)
HKIT needs to develop a system to keep the students’ profile including the name, student id, the programme enrolled by the student, address of student and age. Student could read and modify his/her profile. Please help construct a Student class for this purpose.
class Student {
//variables (2 marks)
//getter (one getter is ok) (1 mark)
//setter (one setter is ok) (2 mark)
public class Student {
private String name;
private Integer age;
public String getName() {
return name;
}
public void setAge(Integer age) {
this.age = age;
}
}
Comments
Leave a comment