hi,
i have been working on a java gradebook that uses traversals, insertions, deletions, and such. i have really just started working and have ran into a few little problems. im kind of working on it in a weird order, so please excuse that.
/* * To change this template, choose Tools | Templates * and open the template in the editor. */ /** * * @author chsstudent */ public class student { String StudentName; int qz1; int qz2; int qz3; int qz4; int qz5; public student (String name, int q1, int q2, int q3, int q4, int q5) { StudentName = name; qz1 = q1; qz2 = q2; qz3 = q3; qz4 = q4; qz5 = q5; } public void setQuiz () { } public int getQuiz (int q1, int q2, int q3, int q4, int q5) { return } public void toString(String name, int q1, int q2, int q3, int q4, int q5) { System.out.println(" Name = " + name + " Q1 = " + q1 + " Q2 = " + q2 + " Q3 = " + q3 + " Q4 = " + q4 + " Q5 = " + q5); } }
my actual problem as of now is that im getting errors on my tester class's arrays. if anyone can spot whats wrong with them it would be greatly appreciated. i really dont know whats wrong with them considering i copied them from examples./* * To change this template, choose Tools | Templates * and open the template in the editor. */ /** * * @author chsstudent */ public class testStudent { student[] grades = new student[5]; //create gradebook grades[0] = new student("Mark", 70, 80, 90, 100, 90); grades[1] = new student("Max", 80, 85, 90, 85, 80); grades[2] = new student("Jean", 50, 79, 89, 99,100); grades[3] = new student ("Betty", 85, 80, 85, 88, 89); grades[4] = new student ("Dilbert", 70, 70, 90, 70, 80); }
---------------------------------------------------------edit------------------------------------
figured out this code, got it working using this
import java.util.*; public class testStudent { public static void main(String [] args) { ArrayList<student> quizzes = new ArrayList<student>(); quizzes.add(new student("Mark", 70, 80, 90, 100, 90)); quizzes.add(new student("Max", 80, 85, 90, 85, 80)); quizzes.add(new student("Jean", 50, 79, 89, 99,100)); quizzes.add(new student("Betty", 85, 80, 85, 88, 89)); quizzes.add(new student("Dilbert", 70, 70, 90, 70, 80)); } }
im now trying to work on my uncompleted methods in my student class. having alot of trouble figuring out the best way to "set" and "get" each quiz score.if anyone has any advice on a good way to do this it would be appreciated. thanks.