Can somebody help me with this?
im trying to create a seatplan program with the following objectives.
1.Allows the user to input a students name,
2.Program then searches the name on a premade list.
3 then prints out the students name, age, chair location.
This is all hay to be done with array of structures.
basically we divided each element into different classes,
but the problem is when we try it writing it into our Main class.
it doesnt accept it, we ended up making the link to the class into an array, but when it comes to inputing certain errors come up. :(
public class Main {
public static void main(String[] args) {
Student students[]=new Student[32];
Student comp=new Student(StudentName.class,17,12,StudentChairLocation.class);
System.out.print(comp.name.First);
}
}
public class Student {
StudentName name;
int age;
String course;
StudentChairLocation chairLocation;
public Student(StudentName n,int a, String c, StudentChairLocation cl){
name=n;
age=a;
course=c;
chairLocation=cl;
}
}
public class StudentChairLocation {
int Row;
int Column;
public StudentChairLocation(int r,int c){
Row=r;
Column=c;
}
}
public class StudentName {
String First;
String Midle;
String Last;
public StudentName(String f,String m,String l){
First=f;
Midle=m;
Last=l;
}
}


Sign In
Create Account


Back to top










