Skip to main content

need for urgent help please

1 reply [Last post]
albukhari87
Offline
Joined: 2010-06-05

Hi all
i hope everyone is doing well

before i start, i would like to let you know that i am so beginner in Java, i have a homework to do about writing student names and grades, the number of students in given by the user, i tried my best to solve this homework but there is something wrong in my program where i could move further

can you please take a look at my code and tell me what is the problem (i think the problem is to define and initialization method, but i do not know how?

please replay and let me how can i continue my homework

regards

import java.applet.*;
import java.awt.*;
import java.awt.event.*;
import java.util.*;

public class students_grades extends Applet implements ActionListener {
Label title = new Label("<{This program calculate students grades in 6 subjects}>");
Label number_of_students = new Label("<{Inter the number of the students}>");
TextField number_of_students_ = new TextField(5);
Button View_Table = new Button ("View Table");

public void init( ) {
//setLayout();
add (title);
add (number_of_students);
add (number_of_students_);
add (View_Table);
number_of_students_.addActionListener(this);
View_Table.addActionListener(this);

}
public void actionPerformed(ActionEvent event) {

// to get the number of students entered by user
// String titles [8] = [No. , Student Name, Math, Comp, Salam, Arab, MGT, ORG];
String number_of_students_text = number_of_students_.getText();
int number_of_students_int = Integer.parseInt(number_of_students_text);

// define two arrays of textfield
TextField txtname []= new TextField [number_of_students_int];
TextField txtgrade [][] = new TextField [number_of_students_int][6];

// define two arrays ===> one for student names, and the other one for students grade
String students_names [] = new String [number_of_students_int];
float students_grades [][] = new float [number_of_students_int][6];

// add name text fields
for (int i=0; i

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
jaywayjohan
Offline
Joined: 2008-06-18

IMHO this is not the right forum for your question...