Category Archives: Computer Science

SeatingChart Java OOP Project – 2D Arrays

Let’s write a program for something like PowerSchool that helps organize a seating chart for students.  There is a tester file at the page’s bottom.

First class : Student   , from https://mrmonline.org/student-class/

Class SeatingChart

This class mainly manages a 2-d  array of student objects. Note: an empty seat in the chart will be designated by a null  value.

private Student[][] chart ; // rows and columns for where kids are
private String rosterName; //name of this roster
private String teacherName; 
private int period ; //which period is this chart associated 
public static final int DEFAULT_ROWS = 10;
public static final int DEFAULT_COLS = 10;

Constructor(s)

  • public SeatingChart(int per, String teacher, String _rosterName)  Initializes parameters to respective arguments and creates a 2-d array  of null  objects with default dimensions DEFAULT_ROWS , DEFAULT_COLS
  • public SeatingChart(int per, String teacher, String _rosterName, Student[][] table)

Methods:

public String getTeacherName() // returns teacherName

public String getRosterrName() // returns  rosterName

public int getPeriod()  // returns period

public int countEmptySeats()  ; //returns the number of empty seats. As noted earlier, an empty seat is represented by a null  value in the 2-d array of student s

Student[][] getStudentChart()  @returns chart

public int[] indexOf(Student stu);  returns a 2 element array representing the row and column position of stu in chart ; [-1 , -1] should be returned if stu is not in chart

public boolean setSeat(int row, int col, Student stu) –  places Student Stu   at that row  and column .  This can only be done if there is no student in that location. If a student already inhabits that row and column then the method should return false  and not make any changes to chart .

public void swap(Student s1, Student s2)  // this swaps the locations of s1  and s2

public Student getStudent(int row, int col)  returns the student at the given row  and col ; or null  if the seat is empty

public void removeStudentAt(int row, int col)   sets value of object at row  and col  to null 

public boolean equals(SeatingChart other)  // returns true  if all aspects of other are equivalent to self.

public void colMajorForm()  . This prints out the student chart in column major form.   Examine the diagram below showing an example seating chart on the left and the printed output on the right.seating chart col major

public String toString();  //follow the conventions we have been using. When you print out the chart , let’s show “E!” t o indicate an empty seat; for seats with students, just display their name.SeatingChart to string v2

public Student oldest()  // returns the student object with the greatest age

Extra credit

public void randomize()  // this randomizes the chart. Please be prepared to meet with me to discuss your code. (You cannot use a library to do all the work, if such a library even exists)

 

SeatingChartTesterv2.java :

[pastacode lang=”cpp” manual=”import%20java.util.Arrays%3B%0A%0Apublic%20class%20SeatingChartTesterv4%0A%7B%0A%20%20%20%20public%20SeatingChartTesterv4()%0A%20%20%20%20%7B%0A%20%20%20%20p(%22v4%2C%20null%20constructor%20checks%22)%3B%0A%20%20%20%20Student%20amelia%20%3D%20new%20Student(%22Amelia%22%2C%2017)%3B%0A%20%20%20%20Student%20antonioooo%20%3D%20new%20Student(%22antonioooo%22%2C%2014)%3B%0A%0A%20%20%20%20SeatingChart%20period3%20%3D%20new%20SeatingChart(3%2C%20%22Mr.%20M%22%2C%20%22A%20Days%22)%3B%0A%0A%20%20%20%20%0A%20%20%20%20int%20correct%20%3D%200%3B%0A%20%20%20%20int%20wrong%20%20%3D%200%3B%0A%0A%20%20%20%20boolean%20didNotInit%20%3D%20false%3B%0A%20%20%20%20%0A%20%20%20%20%0A%20%20%20%20if(period3.getTeacherName()%20%3D%3D%20null)%0A%20%20%20%20%20%7B%0A%20%20%20%20%20%20%20%20p(%22*non*%20default%20constructordid%20not%20initialize%20teacherName%22)%3B%0A%20%20%20%20%20%20%20%20wrong%2B%2B%3B%0A%20%20%20%20%20%20%20%20didNotInit%20%3D%20true%3B%0A%20%20%20%20%20%20%20%20%7D%0A%20%20%20%20else%0A%20%20%20%20%20correct%2B%2B%3B%0A%20%20%20%20%20%20%20%20%0A%20%20%20%20if(period3.getRosterrName()%20%3D%3D%20null)%0A%20%20%20%20%20%7B%0A%20%20%20%20%20%20%20%20p(%22*non*%20default%20constructor%20did%20not%20initialize%20rosterName%22)%3B%0A%20%20%20%20%20%20%20%20wrong%2B%2B%3B%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20didNotInit%20%3D%20true%3B%0A%20%20%20%20%20%20%20%20%7D%0A%20%20%20%20else%0A%20%20%20%20%20correct%2B%2B%3B%0A%20%20%20%20%20%20%20if(period3.getStudentChart()%20%3D%3D%20null)%0A%20%20%20%20%20%7B%0A%20%20%20%20%20%20%20%20p(%22*non*%20default%20constructor%20did%20not%20initialize%20chart%22)%3B%0A%20%20%20%20%20%20%20%20wrong%2B%2B%3B%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20didNotInit%20%3D%20true%3B%0A%20%20%20%20%20%20%20%20%7D%0A%20%20%20%20else%0A%20%20%20%20%20correct%2B%2B%3B%0A%20%20%20%20%20%0A%20%20%20%20%20if%20(%20didNotInit%20%3D%3D%20true)%0A%20%20%20%20%20%7B%0A%20%20%20%20%20%20%20%20throw%20new%20Error(%22You%20must%20fix%20your%20constructor%20(non%20default)%20before%20doin%20anything%20else%20%5Cn%5Ct%20exiting%20tester%22)%3B%0A%20%20%20%20%20%20%20%20%20%0A%20%20%20%20%20%20%20%20%20%0A%20%20%20%20%20%7D%0A%20%20%20%20%20%2F%2F%20now%20let’s%20do%20the%20same%20for%20default%20%20constructor%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%2F%2FSeatingChart(int%20per%2C%20String%20teacher%2C%20String%20_rosterName%0A%20%20%20%20%20SeatingChart%20dfault%20%3D%20new%20SeatingChart(%202%2C%20%22Mr.%20Lorensax%22%2C%20%22periods%202%20%22)%3B%0A%20%20%20%20%20%0A%20%20%20%20%20if(dfault.getRosterrName()%20%3D%3D%20null)%0A%20%20%20%20%20%7B%0A%20%20%20%20%20%20%20%20p(%22%20default%20constructor%20did%20not%20initialize%20rosterName%22)%3B%0A%20%20%20%20%20%20%20%20wrong%2B%2B%3B%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20didNotInit%20%3D%20true%3B%0A%20%20%20%20%20%20%20%20%7D%0A%20%20%20%20else%0A%20%20%20%20%20correct%2B%2B%3B%0A%20%20%20%20%20%20%20if(dfault.getStudentChart()%20%3D%3D%20null)%0A%20%20%20%20%20%7B%0A%20%20%20%20%20%20%20%20p(%22%20default%20constructor%20did%20not%20initialize%20chart%22)%3B%0A%20%20%20%20%20%20%20%20wrong%2B%2B%3B%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20didNotInit%20%3D%20true%3B%0A%20%20%20%20%20%20%20%20%7D%0A%20%20%20%20else%0A%20%20%20%20%20correct%2B%2B%3B%0A%20%20%20%20%20%0A%20%20%20%20%20if%20(%20didNotInit%20%3D%3D%20true)%0A%20%20%20%20%20%7B%0A%20%20%20%20%20%20%20%20throw%20new%20Error(%22You%20must%20fix%20your%20constructor%20(%20%20default)%20before%20doin%20anything%20else%20%5Cn%5Ct%20exiting%20tester%22)%3B%0A%20%20%20%20%20%20%20%20%20%0A%20%20%20%20%20%20%20%20%20%0A%20%20%20%20%20%7D%0A%20%20%20%20%20%2F%2Fend%20%20non%20default%20constct%20test%0A%20%20%20%20%20%0A%20%20%20%20%20%0A%20%20%20%20Student%5B%5D%5B%5D%20currentChart%20%3D%20dfault.getStudentChart()%3B%0A%20%20%20%20if(currentChart%5B0%5D.length%20%3D%3D%20SeatingChart.DEFAULT_COLS%20%26%26%20currentChart.length%20%3D%3D%20SeatingChart.DEFAULT_ROWS)%0A%20%20%20%20%20%20%20%20correct%2B%2B%3B%0A%20%20%20%20else%0A%20%20%20%20%20%20%20%20%7B%0A%20%20%20%20%20%20%20%20p(%22*default%20constructor’s%202-d%20Array%20incorrect%20dimensions%22)%3B%0A%20%20%20%20%20%20%20%20wrong%2B%2B%3B%0A%20%20%20%20%20%20%20%20%7D%0A%0A%20%20%20%20boolean%20result%20%3D%20period3.setSeat(5%2C6%2C%20amelia%20)%3B%0A%0A%20%20%20%20if(result)%0A%20%20%20%20%20%20%20%20correct%2B%2B%3B%0A%20%20%20%20else%0A%20%20%20%20%20%20%20%20%7B%0A%20%20%20%20%20%20%20%20p(%22setSeat()%20return%20value%20error%22)%3B%0A%20%20%20%20%20%20%20%20%7D%0A%0A%20%20%20%20Student%5B%5D%5B%5D%20chartNow%20%3D%20period3.getStudentChart()%3B%0A%20%20%20%20if(chartNow%5B5%5D%5B6%5D%20%3D%3D%20amelia)%0A%20%20%20%20%7B%0A%20%20%20%20%20%20%20%20correct%2B%2B%3B%0A%0A%20%20%20%20%20%20%20%20if(%20period3.getStudent(5%2C6)%20%3D%3D%20amelia)%0A%20%20%20%20%20%20%20%20%20%20%20%20correct%2B%2B%3B%0A%20%20%20%20%20%20%20%20else%0A%20%20%20%20%20%20%20%20%20%20%20%20%7B%0A%20%20%20%20%20%20%20%20%20%20%20%20p(%22Error%2C%20looks%20like%20getStudent()%20%22)%3B%0A%20%20%20%20%20%20%20%20%20%20%20%20%7D%0A%0A%20%20%20%20%7D%20%20%20%20%0A%20%20%20%20else%0A%20%20%20%20%20%20%20%20%7B%0A%20%20%20%20%20%20%20%20p(%22A)%20erorr%2C%20probably%20from%20setSeat()%20or%20getStudentChart()%20%22)%3B%0A%20%20%20%20%20%20%20%20wrong%2B%2B%3B%0A%20%20%20%20%20%20%20%20%7D%0A%0A%0A%0A%20%20%20%20int%5B%5D%20locaxn%20%3D%20period3.indexOf(amelia)%3B%0A%20%20%20%20if(locaxn%5B0%5D%3D%3D5%20%26%26%20locaxn%5B1%5D%20%3D%3D%206)%0A%20%20%20%20%20%20%20%20correct%2B%2B%3B%0A%20%20%20%20else%0A%20%20%20%20%20%20%20%20%7B%0A%20%20%20%20%20%20%20%20p(%22B)%20setSeat()%20or%20indexOf()%20error%22)%3B%0A%20%20%20%20%20%20%20%20wrong%2B%2B%3B%0A%20%20%20%20%20%20%20%20%7D%0A%20%20%20%20result%20%3Dperiod3.setSeat(5%2C6%2C%20antonioooo%20)%3B%0A%0A%20%20%20%20if(result%3D%3D%20false)%0A%20%20%20%20%20%20%20%20correct%2B%2B%3B%0A%20%20%20%20else%0A%20%20%20%20%20%20%20%20%7B%0A%20%20%20%20%20%20%20%20p(%22C)%20setSeat()%20return%20value%20error%22)%3B%0A%20%20%20%20%20%20%20%20wrong%2B%2B%3B%0A%20%20%20%20%20%20%20%20%7D%0A%0A%20%20%20%20String%20st%20%3D%20period3.toString()%3B%0A%20%20%20%20%0A%20%20%20%2F%2F%20System.out.println(st)%20%3B%0A%0A%20%20%20%20if(st.indexOf(%22SeatingChart%22)%20%3D%3D%200)%0A%20%20%20%20%20%20%20%20correct%2B%2B%3B%0A%20%20%20%20else%7B%0A%20%20%20%20%20%20%20%20p(%22toString()%20error.%20ClassName%20should%20be%20first%20characters%22)%3B%0A%20%20%20%20%20%20%20%20wrong%2B%2B%3B%0A%20%20%20%20%7D%0A%0A%20%20%20%20if(st.contains(%22Mr.%20M%22))%0A%20%20%20%20%20%20%20%20correct%2B%2B%3B%0A%20%20%20%20else%7B%0A%20%20%20%20%20%20%20%20p(%22toString()%20error.%20%22)%3B%0A%20%20%20%20%20%20%20%20wrong%2B%2B%3B%0A%20%20%20%20%7D%0A%20%20%20%0A%20%20%20%20if(st.contains(%22A%20Days%22))%0A%20%20%20%20%20%20%20%20correct%2B%2B%3B%0A%20%20%20%20else%7B%0A%20%20%20%20%20%20%20%20p(%22toString()%20error.%20%22)%3B%0A%20%20%20%20%20%20%20%20wrong%2B%2B%3B%0A%20%20%20%20%7D%0A%2F%2Fnew%20seating%20chart%0AStudent%20tim%20%3D%20new%20Student(%22tim%22)%3B%0AStudent%5B%5D%5B%5D%20%20someKids%3D%20%7B%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%7B%20new%20Student(%22giorgio%22)%2Cnull%2C%20%20tim%20%2C%20%7D%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%7B%20new%20Student(%22michael%22)%2C%20new%20Student(%22joe%22%2C%2012)%20%2C%20null%20%7D%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%7B%20null%2C%20new%20Student(%22Alex%22)%2C%20new%20Student(%22Eliam%22%2C%20999)%2C%20null%7D%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%7B%20new%20Student(%22Jen%22)%2Cnull%2C%20%20new%20Student(%22antonio%22%2C%205)%2C%20%20%7D%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%7D%3B%0A%0A%20%20%20%20SeatingChart%20period4%20%3D%20new%20%20SeatingChart(4%2C%20%22MR%20M%22%2C%20%22p4%22%2C%20someKids)%3B%0A%2F%2FSystem.out.println(%20period4%20)%3B%0A%2F%2Fmake%20sure%20that%20someKids%20was%20actually%20set%20to%20the%20chart%0A%20if(period4.getStudentChart()%20%3D%3D%20null)%0A%20%20%20%20%20%20%20%20%7B%0A%20%20%20%20%20%20%20%20wrong%2B%2B%3B%0A%20%20%20%20%20%20%20%20p(%22Non%20default%20constructor’s%20chart%20not%20initialized%22)%3B%0A%20%20%20%20%20%20%20%20%7D%0A%20%20%20%20else%0A%20%20%20%20correct%2B%2B%3B%0A%20%20%20%20%0A%20%20%20%20%0AStudent%5B%5D%5B%5D%20p4Chart%20%3D%20period4.getStudentChart()%3B%0Aif(%20Arrays.equals(p4Chart%20%2C%20someKids))%0A%20%20%20%20correct%2B%2B%3B%0Aelse%0A%20%20%20%20%7B%0A%20%20%20%20wrong%2B%2B%3B%0A%20%20%20%20p(%22Error%20.%20Looks%20like%20you%20did%20not%20correctly%20instantiate%202-d%20array%20in%20constructor%20%22)%3B%0A%20%20%20%20%7D%0A%0A%0A%0A%0A%20%20%20%20boolean%20isCorrect%20%3D%20true%3B%0AStudent%20oldest%20%20%3D%20null%20%3B%0A%20%20%20%20try%7B%0A%20%20%20%20oldest%20%3D%20period4.oldest()%3B%0A%20%20%20%20%7D%0A%20%20%20%20catch(NullPointerException%20e)%7B%0A%20%20%20%20%20%20%20%20isCorrect%20%3D%20false%3B%20%20%20%20%0A%20%20%20%20%20%20%20%20%20%20%20%20p(%22Error%20%40%20oldest()%2C%20you%20cannot%20call%20.getAge()%20on%20a%20null%20object%22)%3B%0A%20%20%20%20%20%20%20%20%7D%0A%20%20%20%0Aif(isCorrect%20%26%26%20oldest%20!%3D%20null%20%26%26%20oldest.getAge()%20%3D%3D999)%0Acorrect%2B%2B%3B%0Aelse%0A%20%20%20%20%7B%0A%20%20%20%20wrong%2B%2B%3B%0A%20%20%20%20p(%22Error%20%40%20oldest()%22)%3B%0A%20%20%20%20%7D%0A%20%20%20%20locaxn%20%3D%20period4.indexOf(tim)%3B%0A%20%20%20%20%0A%0A%0A%0A%20%20%20%20if(locaxn%5B0%5D%3D%3D0%20%26%26%20locaxn%5B1%5D%20%3D%3D%202)%0A%20%20%20%20%20%20%20%20correct%2B%2B%3B%0A%20%20%20%20else%0A%20%20%20%20%20%20%20%20%7B%0A%20%20%20%20%20%20%20%20p(%22A%20incorrect%20student.%20Could%20be%20constructor%22)%3B%0A%20%20%20%20%20%20%20%20wrong%2B%2B%3B%0A%20%20%20%20%20%20%20%20%7D%0A%20%20%20%20%20%20%20%0Aif%20(%20period4.getStudent(0%2C2)%20%3D%3D%20tim%20)%0A%20%20%20%20%20%20%20%20correct%2B%2B%3B%0A%20%20%20%20else%0A%20%20%20%20%20%20%20%20%7B%0A%20%20%20%20%20%20%20%20p(%22B%20incorrect%20student.%20Could%20be%20constructor%2C%20getStudent()%22)%3B%0A%20%20%20%20%20%20%20%20wrong%2B%2B%3B%0A%20%20%20%20%20%20%20%20%7D%0A%20%20%20%20%2F%2F%2F%0A%0A%0Aint%20emptySeats%20%3D%20period4.countEmptySeats()%3B%0A%0A%0A%0Aif(emptySeats%20%3D%3D%205)%0A%20%20%20%20%20%20%20%20correct%2B%2B%3B%0A%20%20%20%20else%0A%20%20%20%20%20%20%20%20%7B%0A%20%20%20%20%20%20%20%20p(%22countEmptySeats()%20error%22)%3B%0A%20%20%20%20%20%20%20%20wrong%2B%2B%3B%0A%20%20%20%20%20%20%20%20%7D%0A%0A%0AStudent%20vinnie%20%3D%20new%20Student(%22Vinnie%22%2C%2016)%3B%0AStudent%20yuya%20%3D%20new%20Student(%22Yuya%22%2C%2018)%3B%0AStudent%5B%5D%5B%5D%20%20p5Kids%20%3D%20%7B%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%7B%20yuya%2C%20vinnie%7D%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%7D%3B%0A%0ASeatingChart%20period5%20%3D%20new%20%20SeatingChart(4%2C%20%22MR%20M%22%2C%20%22p4%22%2C%20p5Kids)%3B%0A%0Aint%5B%5D%20%20yuyaLocation_befo%20%3D%20period5.indexOf(yuya)%3B%0Aint%5B%5D%20%20vinniaLocation_befor%20%3D%20period5.indexOf(vinnie)%3B%0A%0A%0A%0Aperiod5.swap(vinnie%2Cyuya)%20%3B%0Aint%5B%5D%20%20yuyaLocation_now%20%3D%20period5.indexOf(yuya)%3B%0Aint%5B%5D%20%20vinniaLocation_now%20%3D%20period5.indexOf(vinnie)%3B%0A%0Aif(%20yuyaLocation_now%5B0%5D%20%3D%3D%20vinniaLocation_befor%5B0%5D%20%26%26%20%20yuyaLocation_now%5B1%5D%20%3D%3D%20vinniaLocation_befor%5B1%5D%20%20)%0A%20%20%20%20%20%20%20%20correct%2B%2B%3B%0A%20%20%20%20else%0A%20%20%20%20%20%20%20%20%7B%0A%20%20%20%20%20%20%20%20p(%22Error%20Swap%22)%3B%0A%20%20%20%20%20%20%20%20wrong%2B%2B%3B%0A%20%20%20%20%20%20%20%20%7D%0Aif(%20vinniaLocation_now%5B0%5D%20%3D%3D%20yuyaLocation_befo%5B0%5D%20%26%26%20%20vinniaLocation_now%5B1%5D%20%3D%3D%20yuyaLocation_befo%5B1%5D%20%20)%0A%20%20%20%20%20%20%20%20correct%2B%2B%3B%0A%20%20%20%20else%0A%20%20%20%20%20%20%20%20%7B%0A%20%20%20%20%20%20%20%20p(%22Error%20Swap%22)%3B%0A%20%20%20%20%20%20%20%20wrong%2B%2B%3B%0A%20%20%20%20%20%20%20%20%7D%0A%2F%2F%2F%2F%0A%2F%2F%0A%0A%0AStudent%20rany%20%3D%20new%20Student(%22rany%22%2C%2016)%3B%0AStudent%5B%5D%5B%5D%20%20p6Kids%20%3D%20%7B%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%7B%20rany%2C%20null%2Cnull%2Cnull%7D%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%7B%20null%2C%20null%2Cnull%2Cnull%7D%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%7D%3B%0A%0ASeatingChart%20period6%20%3D%20new%20%20SeatingChart(4%2C%20%22MR%20M%22%2C%20%22p4%22%2C%20p6Kids%20)%3B%0Aperiod6.removeStudentAt(0%2C0)%3B%0Aif(%20period6.getStudent(0%2C0)%20%3D%3D%20null%20)%0A%20%20%20%20%20%20%20%20correct%2B%2B%3B%0A%20%20%20%20else%0A%20%20%20%20%20%20%20%20%7B%0A%20%20%20%20%20%20%20%20p(%22Error%20%40%20removeStudentAt()%20%22)%3B%0A%20%20%20%20%20%20%20%20wrong%2B%2B%3B%0A%20%20%20%20%20%20%20%20%7D%0A%0Aif(%20period5.equals(period6)%20%3D%3D%20false)%0A%20%20%20%20%20%20%20%20correct%2B%2B%3B%0A%20%20%20%20else%0A%20%20%20%20%20%20%20%20%7B%0A%20%20%20%20%20%20%20%20p(%22A%20Error%20%40%20equals()%20%22)%3B%0A%20%20%20%20%20%20%20%20wrong%2B%2B%3B%0A%20%20%20%20%20%20%20%20%7D%0Aif(%20period5.equals(period5)%20)%0A%20%20%20%20%20%20%20%20correct%2B%2B%3B%0A%20%20%20%20else%0A%20%20%20%20%20%20%20%20%7B%0A%20%20%20%20%20%20%20%20p(%22B%20Error%20%40%20equals()%20%22)%3B%0A%20%20%20%20%20%20%20%20wrong%2B%2B%3B%0A%20%20%20%20%20%20%20%20%7D%0A%0ASeatingChart%20period6Clone%20%3D%20new%20%20SeatingChart(4%2C%20%22MR%20M%22%2C%20%22p4%22%2C%20p6Kids%20)%3B%0A%0Aif(%20period6.equals(period6Clone)%20)%0A%20%20%20%20%20%20%20%20correct%2B%2B%3B%0A%20%20%20%20else%0A%20%20%20%20%20%20%20%20%7B%0A%20%20%20%20%20%20%20%20p(%22C%20Error%20%40%20equals()%20%22)%3B%0A%20%20%20%20%20%20%20%20wrong%2B%2B%3B%0A%20%20%20%20%20%20%20%20%7D%0A%0A%0A%0A%0Ap(%22———————————-%22)%3B%0Ap(%22Correct%20%3A%20%22%20%2B%20correct)%3B%0Ap(%22Wrong%20%3A%20%22%20%2B%20wrong)%3B%0A%0A%0A%20%20%20%20%7D%2F%2Fend%20of%20constructor%0A%0Avoid%20p(String%20x)%20%7B%20System.out.println(x)%3B%20%7D%0Avoid%20p(int%20x)%20%7B%20System.out.println(x)%3B%20%7D%0Avoid%20p(boolean%20x)%20%7B%20System.out.println(x)%3B%20%7D%0Avoid%20p(double%20x)%20%7B%20System.out.println(x)%3B%20%7D%0Avoid%20p2d(int%5B%5D%20x)%20%7B%20System.out.println(x%5B0%5D%20%2B%20%22%2C%20%20%22%20%2B%20x%5B1%5D)%3B%20%7D%0A%0A%7D%0A” message=”SeatingChartTester” highlight=”3″ provider=”manual”/]

So, you want to Skip CS II

It is very rare that I recommend anyone skip from the Intro class, the easiest CS class,  to SUPA, the hardest CS class , without the foundation that we build in Computer Science II.

The path to skipping

If you  really want to try to skip CS II, the path would be to complete the online component of CS II curriculum during the school year and to then sit down with me for an interview. If I am satisfied that you are ready to skip CS II, I will then make the recommendation.

Much, though not all, of the CS II curriculum is online and so can be completed at a student’s convenience.

Please know, that most of the students who have followed this path and who found the Intro to CS class too easy and who then skipped into SUPA have ended up regretting this and, more often than not, they have had to drop the SUPA class.

Ask yourself– Would you skip Calculus I and instead jump right to Calculus II?

Probably not.

And it’s not much different here;  while it has been done,  for the most part it has only been successfully pulled off by students who are “hardcore” programmers and who have voluminous experience coding outside the classroom. Kids who have made their own apps and learned how to do real programming on their own.

Now, if that describes you and you have made real apps that you can show, then maybe this is the right move, but otherwise, this jump almost never is.

So, what students should do is this – Have your guidance counsellor sign you up for CS II for next year.   If you complete the online  part of the CS II curriculum, by June, then we can sit down and I will have an assessment of your readiness to make this radical jump.

Mini Open Ended Project

Normally we dedicate an entire quarter to a project. We will instead be dedicating about 2/3 of the quarter.

The parameters are similar but not quite so grand in scope. To get an A, you must create a complex web product . This could be a single interactive application or multiple pages . Simple ideas to get to that point include:

  • a multipage form validation product
    • Multiple pages like the login form
      • validate other things – maybe credit cards
  • A to do list that uses jQuery for animation
  • a game that uses Phaser.io ( not trivial,  but fun)
  • Learn php and mysql to create a simple login system. This would only be for those of you who have been able to successfully setup apache, mysql –probably only the windows users.

Ways to add complexity:

  • include loops
  • include arrays
  • include a 3rd party javascript library like jQuery, Vue  etc..
  • I know  jQuery or undescore , if you want something where I can add somequick tidbits when you’re stuck

 

Everybody must use git and have at least 20 commits over the span of the rest of the quarter.

 

Examples of finished product and grades:

  1. Advanced Form Validation
    • credit card validation using luhn algorithm
    • registration page
      • email
      • password
      • confirm password
      • gender
      • etc..
  2. 1-3 calculators. The # should depend on the complexity
  3. 2 or 3 pages that involve form validation
    • Example : https://directpay.irs.gov/directpay/payment?execution=e1s2
    • Maybe not the most fun but closes to what we have done in class
  4. Come up with something that you want to do and make it happen.

Mr Morris, I just want to pass.

  • then, do a multi page layout that makes use of foundation instead of bootstrap. Foundation is a similar css  framework, No javascript needed but grade ceiling will be low.

Phaser 3 Links

Phaser

http://phaser.io/learn/  ( Where you should start)

Medium To Advanced Level Links (not to start, but once you have a clue)

  • Emmanuele Feronato – amazing blog about game dev and lots of phaser stuff here .
  • Ourcade Co – great, albeit advanced and very professional, tutorials/tips on phaser dev – here .

Great YouTube Videos

  • Zeneva
    • https://youtu.be/hI_LS8bdkM4 – Setting up Phaser, local server, files, creating scenes . Does not use Classes so easier for most to understand

Prior Projects: https://mrmonline.org/supa-2019-games/

Bootstrap Presentation

Deliverables:

  1. PPT highlight and explaining the most important parts, screenshots showing the code, and what it does ( ie. a screenshot also from the web page)
  2. Have HTML files ready to share demonstrating the code.

I have been asked “How many examples should I have”?

And there is no one answer. You should convey the “major important” aspects. Absolute bare minimum is 5 code examples but there is no need to kill us with redundant code that only has small changes.