hey guys,
im a bit new to this. pls assist me to correct this code :(.
public class studentSystem
{
public static void main(String args[])
{
//Student sw = new Module("");
Student sw = new Student("Sefakor","1112348");
System.out.println(sw);
System.out.println(sw.getName()); //prints Sefakor Selormey
System.out.println(sw.getId()); //prints 1112348
sw.setName("May Stow");
System.out.println(sw.getName());
}
}
public class Student
{
private String name;
private int id;
private Module[] modules;
public Student(String name, int id)
{
this.name = name;
this.id = id;
this.modules = new Module[3];
}
public void setModule(int index, Module module)
{
this.modules[index] = module;
}
public void printModule()
{
for(int i = 0; i < this.modules.length; i++)
{
System.out.println(this.modules[i]);
}
}
public String toString()
{
return "The student's name is: ";
return this.name;
return "and the id number is " + this.id;
}
public String getName()
{
return this.name;
}
public int getId()
{
return this.id;
}
public void setName(String name)
{
this.name = name;
}
public void setId(int id)
{
this.id = id;
}
}