Lab 4- Film Information

Due Oct 16, 11:55

Moodle Link
ft.jpg
Consider the following repl.it: https://repl.it/@JimSkon/FilmViewStart

This program includes functions to read through and list the flim titles in a Film file "film.csv". This is a "comma separated values" file, e.g. each value on a line has a comma separating it.

Goal

Your goal is to fork the repl.it, and create a program for looking up film information.

Step 1

Update the displayFilm(info) so that it displays ALL the information for a given film, and in a nice readable format. Then make a main() function that loops, calling viewByYear() until the user is done.

Step 2

Using checkFileForString() function from the Emily Dickenson (https://repl.it/@JimSkon/EmilyDickinsonUnique) example write a function createUniqueSubjects() that creates a file subjects.txt which holds all the unique subjects in the film file. You will do this by reading through the film file and looking only at the 4th (offset 3) field. You call checkFileForString() to see if the subject is subjects.txt, and appending it to the file if it is not. You will then need to use the editor to delete the first two subjects (Subject and CAT). If you find a blank subject, remove that also. Once this is done you don't need to call the function anymore, you have the list!

Note - you can skip this step and just manually make the file for a loss of 5 points.

Step 2

Make a function called listBySubjects() that lists the subjects with numbers:

1. Comedy
2. Horror
3. Action
4. Drama
5. Mystery
6. Science Fiction
7. Music
8. War
9. Westerns
10. Western
11. Short
12. Adventure
13. Crime
14. Romance
15. Fantasy

Step 3

Make a function getSubjectByIndex(subNumber) that, given a subject number, returns the subject string. You will need to read through the first subNumber lines of the file to get to the subject, and return that string. Make sure to call .strip() on the subject to remove the "\n". This will allow you to take a number that user enters, and turn it into subject string.

Note: you can skip this step, and just hard code the subjects for a loss of 5 points.

Step 4

Make a function that calls getSubjectByIndex(subNumber) to lists the names of the subjects, and then asks for the user to enter a subject number. Then display (nicely formatted) the films with a matching subject field.

Make sure your program handles bad inputs appropriately.

Step 5

Modify the main() funciton so that it has a loop that asks if the user wants to 1. list by year, 2. list by subject, or 3. end program. Then it calls the appropriate function

Example:
Welcome to the film information program.
Select:
 1. List by year
 2. List by subject
 3. exit
 1
What year do you want to see movies for?  1930
Film: Anna Christie  Year: 92 Length: 92 minutes
Actor: Bickford, CharlesActress: Garbo, GretaDirectorBrown, ClarenceRating: No%

Film: Romance  Year: 76 Length: 76 minutes
Actor: Stone, LewisActress: Garbo, GretaDirectorRating: No%

Film: Murder  Year: 95 Length: 95 minutes
Actor: Marshall, HerbertActress: DirectorHitchcock, AlfredRating: No%


Welcome to the film information program.
Select:
 1. List by year
 2. List by subject
 3. exit
 2
1. Comedy
2. Horror
3. Action
4. Drama
5. Mystery
6. Science Fiction
7. Music
8. War
9. Westerns
10. Western
11. Short
12. Adventure
13. Crime
14. Romance
15. Fantasy
Pick a subject:  9
Film: Shalako  Year: 113 Length: 113 minutes
Actor: Connery, SeanActress: Bardot, BrigitteDirectorDmytryk, EdwardRating: No%

Film: Bronco Billy  Year: 116 Length: 116 minutes
Actor: Eastwood, ClintActress: Locke, SondraDirectorEastwood, ClintRating: No%

Film: A Fistful of Dollars  Year: 102 Length: 102 minutes
Actor: Eastwood, ClintActress: Volonte, Gian MariaDirectorLeone, SergioRating: No%

Film: For a Few Dollars More  Year: 130 Length: 130 minutes
Actor: Eastwood, ClintActress: DirectorLeone, SergioRating: No%

Film: Clint Eastwood Collection, The  Year:  Length:  minutes
Actor: Eastwood, ClintActress: DirectorRating: No%

Film: Good, the Bad & the Ugly, The  Year: 163 Length: 163 minutes
Actor: Eastwood, ClintActress: DirectorRating: No%


Welcome to the film information program.
Select:
 1. List by year
 2. List by subject
 3. exit
 3
   

Program Design

Below is the expected design in terms of functions. You may have more functions, but you must have at least these:

Screen_Shot_2018-10-01_at_11.11.14_AM.png

<a href="SDProject1-3?sortcol=0;table=1;up=0#sorted_table" rel="nofollow" title="Sort by this column">Requirement</a>Points<a href="SDProject1-3?sortcol=3;table=1;up=0#sorted_table" rel="nofollow" title="Sort by this column">Comments</a><a href="SDProject1-3?sortcol=4;table=1;up=0#sorted_table" rel="nofollow" title="Sort by this column">Score</a>
Program provides the required function (search by year, search by subject). Also the program uses a file of subjects gleaned from the original text. 40
Code is properly broken up into functions, with one specific task per function. See function hierarchy above. 30
Each function is commented at top of function 10
Program has meaningful comments, good variable names, and good formatting 10
The program has a nice user interface - easy to use. 10
Total

solution

Topic attachments
I Attachment History Action Size Date Who Comment
PNGpng Screen_Shot_2018-10-01_at_11.11.14_AM.png r1 manage 148.7 K 2018-10-01 - 15:11 JimSkon  
JPEGjpg ft.jpg r1 manage 77.0 K 2018-10-01 - 01:02 JimSkon  
Edit | Attach | Watch | Print version | History: r10 | r8 < r7 < r6 < r5 | Backlinks | Raw View | Raw edit | More topic actions...
Topic revision: r6 - 2018-10-08 - JimSkon
 
  • Edit
  • Attach
This site is powered by the TWiki collaboration platform Powered by PerlCopyright © 2008-2019 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback