im making a grades program to try to keep my skills sharp. since i have gotten out of apcs i havent really been doing too much of anything with java. i decided the other day that i was going to try to make a grade program, kind of like what a school would use, but command line ofcourse. im trying to make it better and better as i refresh my skills.
well, i hardly got started and im already crashing. bringing back the horrible memories of apcs.
what my problem is, i have a class for students. im using an arraylist so that everything can be edited pretty easily. im getting really confused on how to store the grades with the students...
should i have one list for each student that holds all grades? etc etc
its getting discouraging, but the main thing people dont really understand when im getting help is that i dont want it to be like a typical beginner oop class where when you want to use it you have a tester class where you so something like Student nathan = new Student(45,32,54,99,100,120); i want the program to rely solely on user input.
I have a menu that will let the user select what they want to do, and from there im trying to get the program to gain the information, so that if someone wanted to use it, they would never have to touch the source code.
sorry, about the rambling, just hard to describe what im trying to do.
btw: not anything for an assignment or school, so im open to whatever help you guys can provide.
here is the source:
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
/**
*
* @author Nathan
*/
import java.util.Scanner;
public class Main {
public static void main(String[]args)
{
Student firstBlock = new Student();
Scanner sc = new Scanner(System.in);
int selection;
do{
System.out.println("\tMenu");
System.out.println("1.Add Students");
System.out.println("2.Add Grades");
System.out.println("3.Remove Students");
System.out.println("4.Remove Grades");
System.out.println("5.Exit");
selection = sc.nextInt();
if(selection == 1){
}
if(selection == 2){
}
}while(selection != 5);
}
}
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
/**
*
* @author Nathan
*/
import java.util.*;
public class Student {
private List<Double> grades = new ArrayList<Double>();
private String name;
private Scanner sc = new Scanner(System.in);
public Student(String n) {
name = n;
}
public Student(String n, List<Double> g) {
name = n;
grades.addAll(g);
}
public void addGrade(double g) {
grades.add(g);
}
public String toString() {
String s = name + ": ";
for (Double i: grades)
return s += i.toString() + " ";
}
}