Presentation is loading. Please wait.

Presentation is loading. Please wait.

Homework 14 Due ( MT sections ) ( WTh sections ) at midnight Sun., 12/7 Mon., 12/8 Problems

Similar presentations


Presentation on theme: "Homework 14 Due ( MT sections ) ( WTh sections ) at midnight Sun., 12/7 Mon., 12/8 Problems"— Presentation transcript:

1 Homework 14 Due ( MT sections ) ( WTh sections ) at midnight Sun., 12/7 Mon., 12/8 Problems http://www.cs.hmc.edu/courses/2003/fall/cs5/week_14/homework.html Tutors available Saturday afternoons Parsons Lab only (maybe) Sunday afternoons Lac Lab and Parsons Sunday evenings Lac Lab and Parsons Monday evenings Lac Lab and Parsons

2 Tutors available -- contact information

3 Tutors available -- lab places and times You may also seek out tutors away from the labs, by phone, in the dorms, etc. Available in the LAC Lab (Linde Activities Center) Available in Parsons PC Labs (the CIS classrooms)

4 Visualizing Objects FilmDB allFilms type name addFilmdisplayAllFilms int count Film[] films … films[0]films[1]films[2] DirectorDB allDirs type name addDirectordisplayAllDirectors int count Director[] dirs dirs[1]dirs[2] … … dirs[0] int capacity

5 Visualizing Objects Film f type name displaygetTitle String titleint year Director d type name getFullNamegetFilmDB String fname String lname … String rating double review Director dir FilmDB filmDB

6 Overview public static void main(String[] args) { // create a FilmDB and a DirectorDB… // start a large while loop

7 Option 7 -- high level if (uc == 7) // adding a film (1) get title (2) check if film is already there! (3) get director’s first and last name (4) check if director is already there! (6) get year, rating, and review (7) create new film (5) create and add director, if needed (8) ADD f d f to f allFilms d ’s filmDB

8 Method Matching allFilms (a FilmDB) addFilm allDirs (a DirectorDB) addDirector f (a Film) getFullName displayAllFilms getFilmDB displayFilmsByDirector d (a Director) displayAllDirectors getTitle findDirectorByName checkForFilm

9 Option 7 -- high level if (uc == 7) // adding a film

10 This space for rent... cheap!

11 Finding a director... public Director findDirectorByName(String fname, String lname) // inside class DirectorDB addDirectordisplayAllDirectors int count Director[] dirs dirs[1]dirs[2] … dirs[0] int capacity

12 Getting a Director ’s name public String getFullName() // inside class Director getFullNamegetFilmDB String fname String lname … FilmDB filmDB

13 Printing a director’s films public void displayFilmsByDirector(String fname, String lname) // inside class DirectorDB addDirectordisplayAllDirectors int count Director[] dirs dirs[1]dirs[2] … dirs[0]

14 Other methods... public void displayFilmsByDirector(String fname, String lname) // inside class DirectorDB

15 films[0]films[1]films[2] dirs[1]dirs[2] … … dirs[0] FilmDB type int Film[] DirectorDB type int Director[]

16 Visualizing Objects FDB name addFilmdisplayAllFilms count films … DDB name addDirectordisplayAllDirectors count dirs

17 Visualizing Objects f name displaygetTitle title year d name getFullNamegetFilmDB fname lname … rating review dir filmDB

18 Visualizing Objects Film type Stringint Director type String double Director FilmDB

19 Finding a director... public Director findDirectorByName(String fname, String lname) // inside class DirectorDB

20 addDirectordisplayAllDirectors int count Director[] dirs dirs[1]dirs[2] … dirs[0] getFullNamegetFilmDB String fname String lname … FilmDB filmDB addDirectordisplayAllDirectors int count Director[] dirs dirs[1]dirs[2] … dirs[0]

21 Printing a director... public String getFullName() // inside class Director

22 Printing a director’s films public void displayFilmsByDirector(String fname, String lname) // inside class DirectorDB

23 Homework 14 Due ( MT sections ) ( WTh sections ) at midnight Sun., 12/9 Mon., 12/10 Problems http://www.cs.hmc.edu/courses/2001/fall/cs5/week_14/homework.html Tutors available Saturday afternoons Lac Lab Sunday afternoons Lac Lab and AC Sunday evenings Lac Lab and AC Monday evenings Lac Lab and AC Joanna Wu & Jenny Xu LAC Andrew Klose & Jessica Lee in AC M. Chase & Chris Lee - LAC W. Berriel & A. Klose - AC

24 Overview public static void main(String[] args) { // Create a FilmDB and a DirectorDB

25 Overview // create a FilmDB and a DirectorDB… // start a large while loop

26 Option 7 -- high level if (userchoice == 7) // adding a film

27 Option 7 -- high level if (userchoice == 7) // adding a film (1) get title (2) check if film is already there! (3) get director’s first and last name (4) check if director is already there! (6) get year, rating, and review (7) create new film (5) create and add director, if needed (8) ADD f d d to f f DDB FDB d ’s filmDB

28 Method Matching FDB (a FilmDB) addFilm DDB (a DirectorDB) addDirector f (a Film) getFullName displayAllFilms getFilmDB displayFilmsByDirector d (a Director) displayAllDirectors getTitle findDirectorByName findFilmByTitle

29 Option 7 -- code if (userchoice == 7) // adding a film


Download ppt "Homework 14 Due ( MT sections ) ( WTh sections ) at midnight Sun., 12/7 Mon., 12/8 Problems"

Similar presentations


Ads by Google