Great picture of synchronous vs asyncronous
You cannot place a number variable into the say() method
You must use the World function : what as a string
NEXT: asking user for input and saying it
Class Roster: This class will implement the functionality of all roster for school. It will , in essence, manage an Array of Student objects. Each roster will store a default of 10 Students
|
1 |
boolean addStudent( Student st ) ;//adds the student to the Roster |
public void addStudent(String studentName, int age) ;// adds student name and age to end of roster
. Hint: Make user of the containsStudent() method
public boolean removeStudent(int ssnId ) // removes student from roster based on id. Make sure that you maintain the integrity of the parallel ArrayLists.
public boolean removeStudent(String name) //removes student based on name. Make sure that you maintain the integrity of the parallel ArrayLists.
public boolean removeStudent( Student st) //removes student st. Make sure that you maintain the integrity of the parallel ArrayLists.
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
public class StudentsRunner2{ public static void main(String[] args){ //insert the line of code needed to create the Student object aStudent; String teacher; for (int i =0 ;i < 5; i++) { teacher= inputString("Enter a teacher"); aStudent.addTeacher(teacher); } } } |
1) Construct the Java statement to create the Student object called aStudent in the
StudentsRunner
2)
Back to the Student Class
|
1 2 3 4 5 6 7 8 9 10 |
public class StudentsRunner{ public static void main(String[] args){ Student dom; } } |
1) Construct the Java statement to create the Student object called Dom in the
StudentsRunner
Back to the Student Class
A school district decided to write a program to help keep track of various parts of the school.
It has been decided to store relevant information about Students in a Student class. Each Student will have an array of Strings to store the names of his or her teachers.
private instance variables
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
public class Student { public String name; private int age private double gpa; private //insert array declaration; public Student(){} // default constructor boolean setTeacher (String name, int index){ //missing code } public void setGpa(double to){ //missing code } public double getGPA() // returns gpa } |
Part 1
* Construct the Java statement to declare the array called
teachersNames to store the String names of the student’s teachers
Part 2
A PlayList project will be based on Three Classes
The Artist class will store core information about an artist
The Song class will store basic information about a music song
The PlayList class will manage lists of songs and artists
|
1 2 |
private String artistName ; private Song[] songs ; - an array storing the songs of this artist |
Methods
|
1 2 3 4 5 |
private int indexOf(String songName) // returns index position of parameter in the array public void addSong(Song song) public void removeSong(Song song) public void removeSongByName(String songName) public Song[] getSongs() //returns songs array public String getName() // returns artistName |
Constructor(s):
|
1 2 3 |
public Song(String songName, Artist artist){ //missing code } |
Instance Variables
|
1 2 3 |
private Artist artist ; public String songName ; public long date //(date added to list) |
example of how to get current milliseconds as a long
Method
|
1 |
public Artist getArtist() |
Mutator Methods
Read the following articles and answer handout questions
Steve Jobs article : http://www.forbes.com/sites/jackzenger/2013/08/22/the-big-lesson-about-leadership-from-steve-jobs/
Mark Zuckerberg #1 http://www.inc.com/ekaterina-walter/as-zuckerberg-turns-30-leadership-lessons.html
Mark Zuckerberg #2 [article taken down 🙂 ]