1 Replies - 3381 Views - Last Post: 24 December 2008 - 02:43 PM Rate Topic: -----

#1 bonniezahm  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 7
  • Joined: 24-December 08

Program for student id, task id, and grade (array)

Posted 24 December 2008 - 01:42 PM

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package lab5;
import java.util.Scanner;
/**
 *
 * @author OEM
 */
public class Main {

	/**
	 * @param args the command line arguments
	 */
	public static void main(String[] args) {
		// TODO code application logic here
		Scanner keyboard = new Scanner(System.in);
		int students=5;
		int grades=5;
		double [][]classGrades=new double [students][grades];;
		int studentIndex, gradeIndex,studentNumber,gradeNumber;
		
		for (studentIndex = 1; studentIndex<= students;
			  studentIndex=studentIndex+1){
			for (gradeIndex = 1; gradeIndex<= grades;						gradeIndex=gradeIndex+1){
			System.out.println("Enter Grade Number " + gradeIndex
						+ " for Student " +  studentIndex);
			
do{
		System.out.println("Please enter the student number you wish " +
				"to grade for:");
		studentNumber = keyboard.nextInt();
		if (studentNumber >5){
			
		}


		System.out.println("Please enter the assignment number you wish " +
				"to grade:");
		gradeNumber=keyboard.nextInt();
		classGrades[studentNumber][gradeNumber]= keyboard.nextInt();
		System.out.println("Student Id:" + studentNumber +"Grade Id:"
				+ gradeNumber + "Grade for Assignment:" +
				classGrades[studentNumber][gradeNumber] );
				}
				while (studentNumber !=-1);

			}

			}


			}
		 

Before the do I am supposed to input the grade using both indexes and cannot figure out how to write it. I must also write to if statements. THe first must go after the do{ systemoutprintln stating if studentNumber <>0 print line enter the grade you wish for this student. The second goes after the input for that printline stating if the numbers entered are 0 or 6 and higher it is an error. I do not really know the language so that is why I am stuck. If someone could help that would be great.

Is This A Good Question/Topic? 0
  • +

Replies To: Program for student id, task id, and grade (array)

#2 amir_ju  Icon User is offline

  • D.I.C Head

Reputation: 17
  • View blog
  • Posts: 82
  • Joined: 20-June 08

Re: Program for student id, task id, and grade (array)

Posted 24 December 2008 - 02:43 PM

Your program has a syntax error: insert "}" to complete class body.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1