By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,241 Members | 733 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,241 IT Pros & Developers. It's quick & easy.

These are the suggestion for my project. Do you mind having a look

P: 13
Step Description of Task Remark
1 Create a class to represent the student
This class is to define the following data items:
o declare the variables required to store the data of one student (id, name, surname, group)
assign default values to each of these variables
2 Create a number of methods in this class to be able to:
o set the values (set methods) for each of these variables from another class
o return the values of individual variables of this class (get methods) to a calling class
o to enter via keyboard the values for all the variables for a single student e.g.
o setID()
o setName()
o setSurname()
o setGroup()
o getID()
o getName()
o getSurname()
o getGroup()
o enterDetails()
3 Create a main class to declare system variables and control the primary interface to the system

This class has to have a main() method.

4
Declare a data structure e.g. an array of 10 objects of type student

Student studentList[] = new Student[10];
5 In the main class create a process to input the details of 10 students. You can use a loop structure to do the following set of actions for each student:
i) Assign a new instance of the student class to an array element
ii) Call the methods to enter each of the student details (id, name, surname, group) , set the values to the class variables of that array element
repeat statements like :

studentList[n] = new Student();
studentList[n].enterDetails();


6 Add a set of statements to allow the user to input an element number and then enter the details of the student and replace the current array element values with the input values. to assign one attribute e.g
System.out.printlin(“Enter Name: “);
studentList[n].setName(Keyboard.readString()))
7 Add a set of statements to allow the user to input an element number and then display the details of the student e.g. // to display one attribute

System.out.printlin(“Name: “+ studentList[n].getName);
8 In the main class create a process to display the details of the 10 students you can use a loop structure to display the details of each student using the get function for each class variable

for ( ...; ... ; ...) {
....
System.out.print(“Name: “+ studentList[n].getName);
...
...
}
9 In the main class add stateme nts to create a menu of options as follows:
a. Enter details of a list of students and store in array
b. Enter details of a single student
c. Display details of a single student
d. Display details of list of students
e. Exit the system

Add a statement to input the user’s choice
// a menu

// display option 1
// display opton 2
// display option 3
..
..
// enter choice
10 Add statements to be able to perform each option depending on the selection.
// input option

switch (option)
case ‘0’:
break;
case ‘1’:
// statements for option 1
break;
case ‘2’:
// statements for option 2
break;
case ’3’:
..
..

}

11 In the main class, create a loop to repeat steps b, c and d (options display, option input , option processing) until the exit option is selected do {
// display
// input
// switch
}
while option != ‘0’


This is how am I programming am I on the right track
I still have a systnex error expected ";" on bold line. please help.This project have a deadline for the 23rd july
public class main_class
{
public static void main (String args []){
Student StudentList a [] = new Student[10];

a.add("Ryan");
a.add("Robert");
a.add("Victor");
a.add("Jim");
a.add("Sammy");
a.add("Leo");
a.add("Mauro");
a.add("Glen");
a.add("Kyle");
a.add("Kurt");


Iterator i = a.iterator();
while (i.hasNext()) {
System.out.println(i.next());
}
}
}
StudentList[n] = new student();
StudentList[n].enterDetails();



System.out.println("Enter id");
StudentList[n].setid(Keyboard.readString()))

System.out.println("Enter Name");
StudentList[n].setName(Keyboard.readString()))

System.out.println("Enter Surname");
StudentList[n].setSurname(Keyboard.readString()))

System.out.println("Enter Group");
StudentList[n].setGroup(Keyboard.readString()))


System.out.println("id:"+StudentList[n].getid);
System.out.println("Name:"+StudentList[n].getName);
System.out.println("Surname:"+StudentList[n].getSurname);
System.out.println("Group:"+StudentList[n].getGroup);


for(id;Name;Surname;Group){

System.out.println("id:"+StudentList[n].getid);
System.out.println("Name:"+StudentList[n].getName);
System.out.println("Surname:"+StudentList[n].getSurname);
System.out.println("Group:"+StudentList[n].getGroup);
}
Jul 18 '07 #1
Share this Question
Share on Google+
3 Replies


Expert 10K+
P: 11,448
I still have a systnex error expected ";" on bold line. please help.This project have a deadline for the 23rd july
Student StudentList a [] = new Student[10];
You mean this line? Look what you've typed: a is an array of what type? Student
or StudentList? That's what your compiler is whining about; that variable definition
isn't correct; try either this:

Expand|Select|Wrap|Line Numbers
  1. Student[] a= new Student[10];
  2.  
(I think that's the correct one), or try this:

Expand|Select|Wrap|Line Numbers
  1. StudentList[] a= new Student[10];
  2.  
I don't know the type StudentList, so ...

kind regards,

Jos
Jul 18 '07 #2

P: 13
thanks again for your help it complied on the first part stop again under the brackets saying class interface ,or enum expected.
Jul 18 '07 #3

Expert 10K+
P: 11,448
thanks again for your help it complied on the first part stop again under the brackets saying class interface ,or enum expected.
You have to show the relevant part(s) of your source then. It most likely is a
forgotten left or right curly bracket. Check them all (most editors can do that
for you). The compiler expects a class (or an enum since 1.5) at the top level,
i.e. outside of any other class or enum definitions. Reading compiler diagostics
is an accurate little activity.

kind regards,

Jos
Jul 18 '07 #4

Post your reply

Sign in to post your reply or Sign up for a free account.