Hi all - I am a beginner at this and have been pulling my hair out trying to figure out what I'm doing wrong. My error is on the very last line, 61. I get an error message of "reached end of file while parsing." Can someone please help me understand what I'm doing wrong?
Thanks
Student.java file goes with the studentClient.java file
public class Student {
private String name;
private int age;
//Student Constructor
public Student (String newName, int newAge) {
setName(newName);
setAge(newAge);
}
//Mutator method to set student name
public void setName(String newName) {
name = newName;
}
//Accessor method to get student name
public String getName() {
return name;
}
//Mutator method to set student age
public void setAge(int newAge) {
if (newAge > 0)
age = newAge;
else
System.out.println("Age cannot be negative or zero.");
}
//Accessor method to get student age
public int getAge() {
return age;
}
// method to return name and age of student
public String fullString() {
return ("\nName of Student: " + name + "\nAge of Student: " + age + " ");
}
//method to determine type of student
public String typeOfStudent() {
if (age>0 & age<=4) {
return "preschool";
} else {
if (age>=5 & age<=5) {
return "kindergarten";
} else {
if (age>=6 & age<=10) {
return "elementary School";
} else {
if (age>=11 & age<=13) {
return "middle school";
} else {
if (age>=14 & age<=17) {
return "high School";
} else {
if (age>=18 & age<=100) {
return "college";
} else {
return null;
} <----- (error on this line)
StudentClient.java
public class StudentClient
{
public static void main( String [] args )
{
Student student1 = new Student("Bob", 15);
Student student2 = new Student("Jan", 13);
System.out.println("Name: " + student1.getName());
System.out.println("Age: " + student1.getAge());
System.out.println("Type of Student: " + student1.typeOfStudent());
System.out.println("\n" + student2.fullString());
System.out.println("Type of Student: " + student2.typeOfStudent());
student1.setName("Ted");
student1.setAge(35);
System.out.println("\n" + student1.fullString());
System.out.println("Type of Student: " + student1.typeOfStudent());
} //ends main
} //ends program