An unexpected error occured caused by exception IllegalArgumentException:
Expecting collection type [[Lmodels.Question;]
This error appears in localhost when I run the whole project on the browser. I don't understand the error, I checked the all other classes linked to the class Question in a way or another but there isn't any errors, the whole code doesn't have any compilation errors.
This is the class of model Question:
package models;
import play.*;
import play.db.jpa.*;
import javax.persistence.*;
import java.util.*;
#Entity
public class Question extends Model{
public int ExerciseID;
public String theQuest;
public int marks;
public String [] choices;
#ManyToOne
public Exercise myExercise;
#OneToOne (mappedBy="question")
public ModelAn modelAnswer;
public Question (Exercise e, String quest,String [] aofc,int mark){
if(myExercise.noOfQuest<50){
int j = 0;
if (quest != null){
for(int i = 0;i<myExercise.questions.length;i++){
String tempquestion = myExercise.questions[i].theQuest;
if (quest.equals(tempquestion)){
j++;
}}
if(j == 0){
myExercise = new Exercise(e.CreatorID,e.tutID,e.noOfQuest);
myExercise.setPeopleAnswered(e.getPeopleAnswered());
theQuest = quest;
while (aofc.length<=5){
this.choices[0] = aofc[0];
this.choices[1] = aofc[1];
this.choices[2] = aofc[2];
this.choices[3] = aofc[3];
this.choices[4] = aofc[4];
}
this.marks = mark;
}
}
else{
System.out.println("no question was entered please enter a question");
}}else{
System.out.println("the max no of questions was exceeded");
}
}
public void addChoices(Question theQuest,String choice1 , String choice2, String choice3, String choice4, String choice5){
String [] tempchoices = new String[5];
tempchoices[0] = choice1;
tempchoices[1] = choice2;
tempchoices[2] = choice3;
tempchoices[3] = choice4;
tempchoices[4] = choice5;
int j = 0;
for(int i = 1; i <= 5;i++){
if(tempchoices[i] != null){
j++;
}
}
if(j<2){
System.out.println("the options entered are less than 2");
}
else{
theQuest.choices[0] = choice1;
theQuest.choices[1] = choice2;
theQuest.choices[2] = choice3;
theQuest.choices[3] = choice4;
theQuest.choices[4] = choice5;
}
}
public ModelAn getModelAnswer() {
return modelAnswer;
}
public void setModelAnswer(ModelAn modelAnswer) {
this.modelAnswer = modelAnswer;
}
public String getTheQuest() {
return theQuest;
}
public void setTheQuest(String theQuest) {
this.theQuest = theQuest;
}
public int getMarks() {
return marks;
}
public void setMarks(int marks) {
this.marks = marks;
}
public String[] getChoices() {
return choices;
}
public void setChoices(String[] choices) {
this.choices = choices;
}
public Exercise getMyExercise() {
return myExercise;
}
public void setMyExercise(Exercise myExercise) {
this.myExercise = myExercise;
}
}
This error means that you annotated a field of type Question[] as #OneToMany or #ManyToMany somewhere.
You should use collection type such as List<Question> instead, because #OneToMany and #ManyToMany can only be placed on fields of collection types.
Related
I have a big csv file that looks like this
Order ID,Order Priority,Order Quantity,Unit Price,Ship Mode,Customer Name,Customer Segment,Product Category
3,Low,6,38.94,Regular Air,Muhammed MacIntyre,Small Business,Office Supplies
293,High,49,208.16,Delivery Truck,Barry French,Consumer,Office Supplies
293,High,27,8.69,Regular Air,Barry French,Consumer,Office Supplies
483,High,30,195.99,Regular Air,Clay Rozendal,Corporate,Technology
I am able to display it but i don't know how to sort it and display it again sorted. Here's my code so far
package project1;
import java.io.File;
import java.io.FileNotFoundException;
import java.util.Arrays;
import java.util.Scanner;
public class Test {
public static void main(String[] args) throws FileNotFoundException {
Scanner input = new Scanner(System.in);
int choice=0;
boolean flag = true;
while (flag) {
System.out.println("Enter 1 to display data.");
System.out.println("Enter 2 to sort data.");
System.out.println("Enter 3 to idk.");
System.out.println("Enter 0 to exit.");
System.out.print("Your choice: ");
choice = input.nextInt();
if (choice ==1) {
File inputFile = new File("dataToLoad.csv");
String line;
String delimiter = ",";
Scanner in = new Scanner(inputFile);
int numberOfLines = 0;
int numberOfColumns = 0;
while (in.hasNextLine()){
line = in.nextLine();
numberOfLines++;
}
in.close();
String[][] data = new String[numberOfLines][8];
in = new Scanner(inputFile);
int currentRow = 0;
while (in.hasNextLine()){
line = in.nextLine();
String[] parts = line.split(delimiter);
numberOfColumns = parts.length;
for (int i = 0; i<numberOfColumns; i++) {
data[currentRow][i] = parts[i];
}
currentRow++;
}
in.close();
System.out.println(Arrays.deepToString(data));
for (int row=0; row<numberOfLines; row++) {
for (int col=0; col<numberOfColumns; col++) {
System.out.printf("%-20s", data[row][col]);
}
System.out.println();
}
}
else {
if (choice ==2) {
}
else
if (choice==0) {
System.out.println("Good bye!");
flag = false;
}
else System.out.println("I am sorry, this is not a valid option. Please try again.");
}
}
}
}
As you can see, i give the user the option to display the data, display them sorted (according to id) and i also want the user to choose how to sort the code. I am stuck at sorting.
Stop reinventing the wheel; use a csv open source library (for example, opencsv).
Create a class that represents one row of data in your csv file; I'll refer to this as RowClass.
Read the CSV file one row at a time. Each row will arrive as a String[].
Create and populate one instance of RowClass per row of the CSV file.
Store the RowClass objects in a List; I'll call this rowList.
Sort rowList using a Comparator that you create. Create one Comparator for each sort option.
Implement RowClass.toString() to display one row.
This should help, I believe that you will figure out what's going on here
Main.java
package pkg;
import java.util.Arrays;
import static pkg.Order.OrderBuilder;
public class Main {
private static Order[] orders = new Order[3];
private static OrderBuilder orderBuilder = new OrderBuilder();
public static void main(String[] args) {
Order order1 = orderBuilder.createNewOrder().withId(10).withCustomerName("John").withPrice(1.23f).withPriority("high").build();
Order order2 = orderBuilder.createNewOrder().withId(20).withCustomerName("Lee").withQuantity(3.4f).build();
Order order3 = orderBuilder.createNewOrder().withId(30).withCustomerName("Someone").withPriority("low").build();
orders[0] = order3;
orders[1] = order1;
orders[2] = order2;
System.out.println("Before sorting");
for(int i = 0; i < orders.length; i++) {
System.out.println(orders[i].getId());
}
Arrays.sort(orders);
System.out.println("After sorting");
for(int i = 0; i < orders.length; i++) {
System.out.println(orders[i].getId());
}
}
}
Order.java
package pkg;
public class Order implements Comparable<Order> {
private int id;
private String priority;
private float quantity;
private float price;
private String shipMode;
private String customerName;
private String customerSegment;
private String productCategory;
private void setId(int id) {
this.id = id;
}
int getId() {
return this.id;
}
private void setPriority(String priority) {
this.priority = priority;
}
private void setQuantity(float quantity) {
this.quantity = quantity;
}
private void setPrice(float price) {
this.price = price;
}
private void setShipMode(String shipMode) {
this.shipMode = shipMode;
}
private void setCustomerName(String customerName) {
this.customerName = customerName;
}
private void setCustomerSegment(String customerSegment) {
this.customerSegment = customerSegment;
}
private void setProductCategory(String productCategory) {
this.productCategory = productCategory;
}
#Override
public int compareTo(Order o) {
return this.id - o.getId();
}
static class OrderBuilder {
private Order order;
OrderBuilder withId(int id) {
order.setId(id);
return this;
}
OrderBuilder withPriority(String priority) {
order.setPriority(priority);
return this;
}
OrderBuilder withQuantity(float quantity) {
order.setQuantity(quantity);
return this;
}
OrderBuilder withPrice(float price) {
order.setPrice(price);
return this;
}
OrderBuilder withShipMode(String shipMode) {
order.setShipMode(shipMode);
return this;
}
OrderBuilder withCustomerName(String customerName) {
order.setCustomerName(customerName);
return this;
}
OrderBuilder withCustomerSegment(String customerSegment) {
order.setCustomerSegment(customerSegment);
return this;
}
OrderBuilder withProductCategory(String productCategory) {
order.setProductCategory(productCategory);
return this;
}
OrderBuilder createNewOrder() {
order = new Order();
return this;
}
Order build() {
return order;
}
}
}
I'm writing a program to take and organize class info, including the students in a class, recorded by ID and Grade. I'm able to add the students as desired, and they print as desired (so I know the entries are correct), but when I go to search for a student, the search method is only able to find the last entered student ID. Why is my search function breaking down?
The search function:
public static int studentFinder(ClassSection classOne) {
int studentIndex = 0;
boolean searchAgain = false;
boolean correctStudent = false;
do {
studentIndex = idFinder(classOne);
if (studentIndex == -1) {
System.out.println("That student was not found in the class");
System.out.println("Would you like to search again?");
searchAgain = yesNoBool();
} else {
System.out.println("You have selected student ID# " +classOne.getStudentIDByIndex(studentIndex));
System.out.println("Is this correct?");
correctStudent = yesNoBool();
if (!correctStudent) {
System.out.println("Would you like to search again?");
searchAgain = yesNoBool();
}
}
} while(searchAgain);
return studentIndex;
}
ID Finder module:
public static int idFinder(ClassSection classOne) {
int studentID = 0;
String intString = "a Student ID to search for:";
int studentIndex = 0;
System.out.println("Please enter a Student ID to search for:");
studentID = intChecker(intString);
for (int i = 0; i < classOne.students.size(); i++) {
int studentIdTest = classOne.students.get(i).getStudentID();
if (studentIdTest == studentID) {
studentIndex = i;
} else if (studentIdTest != studentID){
studentIndex = -1;
}
}
return studentIndex;
}
The ClassSection class:
import java.util.*;
public class ClassSection {
//instance variables
protected int crnNum = 0;
protected String deptCode = "null";
protected int courseNum = 0;
protected String instructMode = "null";
protected String meetingDays = "null";
protected String meetingTimesStart = "null";
protected String meetingTimesEnd = "null";
protected int classCapacity = 0;
protected int classEnrollment = 0;
protected int instructorID = 0;
protected ArrayList<StudentEnrollee> students = new ArrayList<StudentEnrollee>();
//constructors
public ClassSection(int crnNum, String deptCode, int courseNum, String instructMode, String meetingDays,
String meetingTimesStart, String meetingTimesEnd, int classCapacity, int classEnrollment,
int instructorID) {
super();
this.crnNum = crnNum;
this.deptCode = deptCode;
this.courseNum = courseNum;
this.instructMode = instructMode;
this.meetingDays = meetingDays;
this.meetingTimesStart = meetingTimesStart;
this.meetingTimesEnd = meetingTimesEnd;
this.classCapacity = classCapacity;
this.classEnrollment = classEnrollment;
this.instructorID = instructorID;
}
public ClassSection() {
super();
this.crnNum = 0;
this.deptCode = "";
this.courseNum = 0;
this.instructMode = "";
this.meetingDays = "";
this.meetingTimesStart = "";
this.meetingTimesEnd = "";
this.classCapacity = 0;
this.classEnrollment = 0;
this.instructorID = 0;
}
//getters and setters
public void getStudents() {
this.students.forEach(System.out::println);
}
public int getStudentIDByIndex(int index) {
return this.students.get(index).getStudentID();
}
public void addStudent(StudentEnrollee student) {
this.students.add(student);
}
public void removeStudent(int removalIndex) {
this.students.remove(removalIndex);
}
public void changeAddStudentGrade(int studentIndex, int studentGrade) {
this.students.get(studentIndex).setStudentGrade(studentGrade);
}
public int getCrnNum() {
return crnNum;
}
public void setCrnNum(int crnNum) {
this.crnNum = crnNum;
}
public String getDeptCode() {
return deptCode;
}
public void setDeptCode(String deptCode) {
this.deptCode = deptCode;
}
public int getCourseNum() {
return courseNum;
}
public void setCourseNum(int courseNum) {
this.courseNum = courseNum;
}
public String getInstructMode() {
return instructMode;
}
public void setInstructMode(String instructMode) {
this.instructMode = instructMode;
}
public String getMeetingDays() {
return meetingDays;
}
public void setMeetingDays(String meetingDays) {
this.meetingDays = meetingDays;
}
public String getMeetingTimesStart() {
return meetingTimesStart;
}
public void setMeetingTimesStart(String meetingTimesStart) {
this.meetingTimesStart = meetingTimesStart;
}
public String getMeetingTimesEnd() {
return meetingTimesEnd;
}
public void setMeetingTimesEnd(String meetingTimesEnd) {
this.meetingTimesEnd = meetingTimesEnd;
}
public int getClassCapacity() {
return classCapacity;
}
public void setClassCapacity(int classCapacity) {
this.classCapacity = classCapacity;
}
public int getClassEnrollment() {
return classEnrollment;
}
public void setClassEnrollment(int classEnrollment) {
this.classEnrollment = classEnrollment;
}
public int getInstructorID() {
return instructorID;
}
public void setInstructorID(int instructorID) {
this.instructorID = instructorID;
}
//mutators
#Override
public String toString() {
return String.format("Crn Number: %20s \nDept Code: %20s \nInstruction Mode: %20s"
+ " \nCourse Number: %20s \nClass Capacity: %20s \nClass Enrollment: %20s"
+ " \nMeeting Days: %20s \nMeeting Times: %8$20s - %9$2s \nInstructor ID: %10$20s \n" + Arrays.toString(students.toArray()).replace("[", "").replace(", S","S").replace("]", "").trim(),
crnNum, deptCode, instructMode, courseNum, classCapacity, classEnrollment, meetingDays,
meetingTimesStart, meetingTimesEnd, instructorID);
}
}
The student enrollee class (where the objects in the arraylist are from):
public class StudentEnrollee {
protected int studentID = 0;
protected int studentGrade = 0;
public StudentEnrollee() {
super();
studentID = 0;
studentGrade = 0;
}
public StudentEnrollee(int studentID, int studentGrade) {
super();
this.studentID = studentID;
this.studentGrade = studentGrade;
}
//setters & getters
public int getStudentID() {
return studentID;
}
public void setStudentID(int studentID) {
this.studentID = studentID;
}
public int getStudentGrade() {
return studentGrade;
}
public void setStudentGrade(int studentGrade) {
this.studentGrade = studentGrade;
}
#Override
public String toString() {
return String.format("Student ID: %20s \nStudent Grade: %20s \n", studentID, studentGrade);
}
}
The intchecker and yesNoBool methods are just error checking and confirmation functions, but here they are just in case:
public static int intChecker(String object) {
boolean correctInput = false;
int userInput = 0;
while (!correctInput) {
try {
userInput = scanner.nextInt();
correctInput = true;
} catch(InputMismatchException e) {
System.out.println("I'm sorry, that doesn't seem to be a number");
System.out.println("Please enter " +object);
scanner.next();
}
}
return userInput;
}
public static boolean yesNoBool() {
String yesNo = "";
boolean yesNoBool = false;
System.out.println("Please enter Y/N");
yesNo = scanner.next();
while ((!yesNo.equalsIgnoreCase("n") && !yesNo.equalsIgnoreCase("y"))){
System.out.println("I'm sorry, please enter Y/N");
yesNo = scanner.next();
}
if (yesNo.equalsIgnoreCase("y")) {
yesNoBool = true;
} else if (yesNo.equalsIgnoreCase("n")) {
yesNoBool = false;
}
return yesNoBool;
}
Once you found the match you have to break the loop, otherwise studentIndex gets overwritten for rest of the records for which loop iterating. Also you don't need if(studentIdTest != studentID) just else is also work same.
Add Break in loop in idFinder method as follows:
for (int i = 0; i < classOne.students.size(); i++) {
int studentIdTest = classOne.students.get(i).getStudentID();
if (studentIdTest == studentID) {
studentIndex = i;
break;
} else{
studentIndex = -1;
}
}
Suggestion: you can intialize studentIndex with -1 instead of setting it in each iteration where match not found.
I hope this will solve your problem.
In your idFinder method, you continue to search for the id even when you find it. In the for loop, you need to stop when you find the id.
Modify your for loop to:
public static int idFinder(ClassSection classOne) {
String intString = "a Student ID to search for:";
int studentIndex = -1; // Initialize the studentIndex to a negative value since 0 is a valid index
System.out.println("Please enter a Student ID to search for:");
int studentID = intChecker(intString);
for (int i = 0; i < classOne.students.size(); i++) {
int studentIdTest = classOne.students.get(i).getStudentID();
if (studentIdTest == studentID) {
studentIndex = i;
break;
}
}
return studentIndex;
}
I'm having a problem with an arrayList in which I store member objects. I think it might be something to do with the way i've declared it. This is what I have so far
Member Class
package assignment;
import java.util.ArrayList;
public class Member {
private int memberID;
private String memberName;
private int memberAge;
private int numOfBooksLoaned;
private int penalties;
public Member(int memberID, String memberName, int memberAge, int numOfBooksLoaned, int penalties) {
this.memberID = memberID;
this.memberName = memberName;
this.memberAge = memberAge;
this.numOfBooksLoaned = numOfBooksLoaned;
this.penalties = penalties;
}
public int getMemberID() {
return memberID;
}
public void setMemberID(int memberID) {
this.memberID = memberID;
}
public String getMemberName() {
return memberName;
}
public void setMemberName(String memberName) {
this.memberName = memberName;
}
public int getMemberAge() {
return memberAge;
}
public void setMemberAge(int memberAge) {
this.memberAge = memberAge;
}
public int getNumOfBooksLoaned() {
return numOfBooksLoaned;
}
public void setNumOfBooksLoaned(int numOfBooksLoaned) {
this.numOfBooksLoaned = numOfBooksLoaned;
}
public int getPenalties() {
return penalties;
}
public void setPenalties(int penalties) {
this.penalties = penalties;
}
}
MemberList class
package assignment;
import java.util.Scanner;
import java.util.ArrayList;
public class MemberList {
private ArrayList<Member> Members;
public MemberList(ArrayList<Member> Members)
{
this.Members = Members;
}
public void addNewMember()
{
Scanner input = new Scanner(System.in);
boolean successful = false;
int memberID;
String memberName;
int memberAge;
do {
System.out.println("/t/tCreate new member" + "/nPlease enter your full name: ");
memberName = input.nextLine();
for (int i = 0; i < Members.size(); i++) {
if (Members.get(i).getMemberName().equalsIgnoreCase(memberName)) {
System.out.println("This member name is already in use");
} else {
successful = true;
}
}
} while (successful == false);
The problem is just after the for loop in the if statement
if (Members.get(i).getMemberName().equalsIgnoreCase(memberName))
the error says that getMemberName() is undefined for type Member.
Any ideas?
I have used this exact same identical way of using an arrayList and it works fine but it isn't working now for some reason.
try to use a foreach loop in this way
for (Member m : Members) {
if (m.getMemberName().equalsIgnoreCase(memberName)) {
System.out.println("This member name is already in use");
} else {
successful = true;
}
}
Another thing, is discouraged to use Capital letter at first letter in class members in Java, define the list as
private ArrayList<Member> members;
I am writing a Java program that I need:
A method to read the customer names and id and store them in an array. (Read a sequence of zero or more lines each containing the name and id of one customer. Instantiate one Customer object per line and store each object in an array of objects. The array need not be more than 10 elements long. The sequence of name and id will end with an empty line).
Main
import java.util.Scanner;
public class CustomerTest {
public static void main(String[] args) {
Customer[] customers = new Customer[10];
Scanner myScanner = new Scanner(System.in);
int numItem;
readCustomer(myScanner, customers); //not sure about this calling
readNameAmount(myScanner, customers); ////not sure about this calling
}
public static void readCustomer(Scanner myScanner, Customer[] input) {
boolean streamEnded = false;
int numItem = 0;
while (!streamEnded && myScanner.hasNext()) {
String name = myScanner.nextLine();
String id = myScanner.nextLine();
if (name.length() == 0 && id.length() == 0) {
streamEnded = true;
} else {
input[numItem] = name; //error
input[numItem] = id; //error
}
numItem++;
Customer customerTest = new Customer(name, id);
}
}
public static void readNameAmount(Scanner myScanner, Customer[] input) {
while (myScanner.hasNext()) {
String id = myScanner.nextLine();
double amount = myScanner.nextDouble();
int i = 0;
boolean found = false;
while (i <numItem && !found) { //error
if (customers[i].equals(id)) { //error
changeBalance(double value);//error
}
found = true;
i++;
}
}
}
public static void print(Customer[] input, int numItem) {
for (int i = 0; i < numItem; i++) {
System.out.println(customers[i].toString()); //error
}
}
}
Can you please check if this works.
I dont know whether I understood your question.And I just cleared the error.
public class CustomerTest {
static int numItem = 0;
public static void main(String[] args) {
Customer[] customers = new Customer[10];
Scanner myScanner = new Scanner(System.in);
readCustomer(myScanner, customers); //not sure about this calling
readNameAmount(myScanner, customers); ////not sure about this calling
}
public static void readCustomer(Scanner myScanner, Customer[] input) {
boolean streamEnded = false;
while (!streamEnded && myScanner.hasNext()) {
String name = myScanner.nextLine();
String id = myScanner.nextLine();
if (name.length() == 0 && id.length() == 0) {
streamEnded = true;
}
else {
input[numItem].getName();
input[numItem].getId(); //error
}
numItem++;
Customer customerTest = new Customer(name, id);
}
}
public static void readNameAmount(Scanner myScanner, Customer[] input) {
while (myScanner.hasNext()) {
String id = myScanner.nextLine();
Customer cust = new Customer();
double amount = myScanner.nextDouble();
int i = 0;
boolean found = false;
while (i < numItem && !found) { //error
if (input[i].equals(id)) { //error
cust.changeBalance(amount);//error
}
found = true;
i++;
}
}
}
public static void print(Customer[] input, int numItem) {
for (int i = 0; i < numItem; i++) {
System.out.println(input[i].toString()); //error
}
}
}
Let me know your thoughts.
Customer.java
public class Customer {
private String name;
private String id;
private double balance;
public Customer(){
}
public Customer(String name, String id) {
this.name = name;
this.id = id;
}
public String getName() {
return name;
}
public String getId() {
return id;
}
public void changeBalance(double value) {
balance = balance + value;
}
public String toString() {
return "name " + name + " id " + id + " balance " + balance;
}
}
This is not supposed to be a client class. I'm just making a class for others to use. I'm using this for a Highschool. For example i have classes for the address, teacher, students, principal, roomnumber, etc..But its not compiling for some odd reason. I believe its because I'm not declaring a field but not sure.
import java.io.*;
public class HighSchool {
// Constructors
public HighSchool() { }
public HighSchool(String title, String teacher, int roomNumber, String period, String[] students, String address, String subjects ) {
this.title = title;
this.teacher = teacher;
this.roomNumber = roomNumber;
this.period = period;
this.String[] students = students;
this.String address =a ddress;
this.String subjects = subjects;
}
public class Classcourse (String title, String teacher, int roomNumber, String period, String[] students, String address, String subjects
private String period;) {
public String gettitle() {
return title;
}
public void settitle(String title) {
this.title = title;
}
public String getteacher() {
return teacher;
}
public void setteacher(String teacher) {
this.teacher = teacher;
}
public int getroomNumber() {
return roomNumber;
}
public void setroomNumber (int roomNumber) {
this.roomNumber = roomNumber;
}
public String getperiod() {
return getperiod();
}
public void setperiod (String period) {
this.period = period;
}
public String[] getstudents () {
return students[];
}
public void setstudents[] (String[] students
private String address;) {
this.students = students;
}
public String getaddress() {
return address;
}
public void setaddress (String address) {
this.address = address;
}
public String getsubjects() {
return subjects;
}
public void setsubjects (String subjects) {
this.subjects = subjects;
}
}
// modifier method
public void addstudents(String students) {
String[] newstudents = new String[students.length + 1];
for (int i = 0; i < students.length; i++) {
newstudents[i] = students[i];
}
newstudents[students.length] = student;
students = newstudents;
}
public boolean isInClass(String students) {
for (int i = 0; i < students.length; i++) {
if (students[i].equals(students)) {
return true;
}
}
return false;
}
// static creator method
public static HighSchool readFromInput() throws IOException {
BufferedReader kb = new BufferedReader(new InputStreamReader(System.in));
System.out.print("Enter a HighSchool title: ");
HighSchool newHighSchool = new HighSchool(kb.readLine());
String students = null;
do {
System.out.print("Enter a student, or press Enter to finish: ");
students = kb.readLine();
if (students != null){
newHighSchool.addstudents(students);
}
} while (students != null);
return newHighSchool;
}
// Variables (Fields)
private String title;
private String[] students;
}
In addition, you wrote something that doesn't make sense from the point of view of Java Compiler:
private String period;) {
- probably remove ")".
The second thing:
Take a look on the declaration of class Classcourse.
It rather sounds wrong, although it can be an issue of this site's editor or something...
An "overall" hint - java has a very "intelligent" compiler in the most of the cases it can say what's wrong exactly with your code, so, assuming you're a newbie in Java, try to understand what compiler says to you.
Good luck!
Some things I noticed about the code:
public String getperiod() {
return getperiod();
}
This code will cause a endless loop when you call this function.
private String address;) {
this.students = students;
}
The compiler will give an error about the ";)". Change it to "()" to fix this.
Furthermore, you should really tell us more about the errors it's giving you. We can't help you if you don't give us the compiler errors.