import java.util.ArrayList; public class StudentRunner { public StudentRunner() { ArrayList students = new ArrayList(); // student 1 Student vinnie = new Student("vinnie", 16) ; Student amelia = new Student("Amelia", 15 ); Student daniyal = new Student("Daniyal ", 16 ); //add 3 students to the arraylist students.add(vinnie ); students.add(amelia); students.add(daniyal ); students.add(new Student("Devin", 17)); students.add(new Student("Jorge", 17)); int correct = 0; int wrong = 0 ; if( amelia.equals(new Student(amelia.getName(), amelia.getAge() ) ) ) { wrong++; p("equals() not working as expected"); } else correct++; if( new Student().equals(new Student() ) ) { wrong++ ; p("equals() not working as expected--default constructor"); } else correct++; if( new Student("Jimmy Bob").equals(new Student("Jimmy Bob") ) ) { wrong++ ; p("equals() not working as expected--String constructor"); } else correct++; if(daniyal.getAge() == 16 ) { correct++; //can we change it now daniyal.setAge(99); if(daniyal.getAge() == 99 ) correct++; else { p("setAge() not working as expected"); wrong++; } } else{ p("getAge() not working as expected"); wrong++; } if(vinnie.getName().equals("vinnie")) { correct++; vinnie.setName("Vinnie"); if(vinnie.getName().equals("Vinnie")) correct++; else{ p("setName() not working as expected"); wrong++; } } else{ p("getName() not working as expected"); wrong++; } //some tests boolean ssnAllGood = true; for( int i = 0 ; i < students.size() -1 ; i++){ { int delta = students.get(i+1).getSSN() - students.get(i).getSSN() ; if( delta != 1 ) { ssnAllGood = false; } } //loop over if(ssnAllGood) correct++; else{ p("getSSN() not working as expected"); p("\tEach Student's SSN should be one greater than prior student "); wrong++; } } p("*************** Test results ******************************") ; p("No. correct " + correct); p("No. wrong : " + wrong); } void p(int i){ System.out.println(i); } void p(String i){ System.out.println(i); } void p(double i){ System.out.println(i); } void p(boolean i){ System.out.println(i); }