1 / 29

Homework 14

Homework 14. Sun., 12/7. ( MT sections ). Due. at midnight. Mon., 12/8. ( WTh sections ). 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

lis
Download Presentation

Homework 14

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Homework 14 Sun., 12/7 ( MT sections ) • Due at midnight Mon., 12/8 ( WTh sections ) • 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 Available in Parsons PC Labs (the CIS classrooms) Available in the LAC Lab (Linde Activities Center) You may also seek out tutors away from the labs, by phone, in the dorms, etc.

  4. Visualizing Objects int capacity int count … films[0] films[1] films[2] Film[] films … addFilm displayAllFilms type FilmDB allFilms name int capacity int count … Director[] dirs dirs[0] dirs[1] dirs[2] addDirector displayAllDirectors type DirectorDB allDirs name

  5. Visualizing Objects Director dir String rating String title double review int year display getTitle type Film f name String fname FilmDB filmDB String lname … getFullName getFilmDB type Director d name

  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! (5) create and add director, if needed d (6) get year, rating, and review (7) create new film f to allFilms f (8) ADD to d’s filmDB f

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

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

  10. This space for rent... cheap!

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

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

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

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

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

  16. Visualizing Objects count films … addFilm displayAllFilms FDB name count dirs addDirector displayAllDirectors DDB name

  17. Visualizing Objects dir rating title review year display getTitle f name fname filmDB lname … getFullName getFilmDB d name

  18. Visualizing Objects Director String String double int type Film String FilmDB String type Director

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

  20. int count … dirs[0] dirs[1] dirs[2] Director[] dirs addDirector displayAllDirectors String fname FilmDB filmDB String lname … getFullName getFilmDB int count … dirs[0] dirs[1] dirs[2] Director[] dirs addDirector displayAllDirectors

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

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

  23. Homework 14 Sun., 12/9 ( MT sections ) • Due at midnight Mon., 12/10 ( WTh sections ) • 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! (5) create and add director, if needed d (6) get year, rating, and review (7) create new film f to DDB d to (8) ADD FDB f to d’s filmDB f

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

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

More Related