Hey I'm new to Java and have been trying to teach myself using a book but I'm being particularly unsuccessful. I have an exam coming up and this is the sample question he gave us as an example.
QUESTION:
Write a Java class called ExamMarks, which specifies a module name (String), module code (int), year (int) and an array of 20 integer marks. The class should have an appropriate three argument constructor, a toString() method and methods displaying the highest mark and the average mark. It should have a separate method to obtain up to 20 marks from the user via the console.
Use appropriate visibility modifiers to ensure encapsulation. In the main(String[]) method create an ExamMarks object.
Marks will be given for good program design, code layout, and choice of identifiers as well as a satisfactory implementation of the requirements above. No marks will be given for comments or the inclusion of extra functionality not described above.
THIS IS WHAT I HAVE SO FAR:
class examMarks {
String name;
int studentNumber;
int marks;
public static void main (String [] args){
int year = 2013;
examMarks [] marks = new examMarks[20];
int z = 0;
while (z < 20) {
z = z + 1;
if (z == 1){
marks[z] = new examMarks();
marks[z].name = "Bob";
marks[z].studentNumber = 106708901;
marks[z].
System.out.println("Student name = " + marks[z].name);
System.out.println("Student number = " + marks[z].studentNumber);
System.out.println("Year = " + year);
}}}}
I know I haven't started encapsulation yet I was going to add that at the end. Can anyone point me in the right direction? I'm kinda stuck. Any thoughts appreciated thanks for your help.
Joe

