class Student
{
// data members
private String _studentNumber;
private String _studentName;
private int _markForMaths;
private int _markForEnglish;
private int _markForScience;
// Set Student Name
public void setStudentName(String studentName)
{
_studentName = studentName;
}
// Set the student number
public void setStudentNumber(String studentNumber)
{
_studentNumber = studentNumber;
}
// getNumber()
// return student number
public String getNumber()
{
return _studentNumber;
}
// getName()
// return student name
public String getName()
{
return _studentName;
}
// entermarks()
// enter all subject marks given as args
public void enterMarks(int maths, int english, int science)
{
_markForMaths = maths;
_markForEnglish = english;
_markForScience = science;
}
// getMathsMark()
// return mark for maths
public int getMathsMark()
{
return _markForMaths;
}
// getEnglishMark()
// return mark for English
public int getEnglishMark()
{
return _markForEnglish;
}
// getScienceMark()
// return mark for Science
public int getScienceMark()
{
return _markForScience;
}
// calculateAverageMark()
// return the average of the three marks
public double calculateAverageMark()
{
return ((_markForMaths + _markForEnglish +
_markForScience) / 3.0);
}
}

Because you have not followed all the instrctions yet. What about "Create the class program that has main() method for execution. This program should create two Student objects and implement all methods listed in the Student class."

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.