Learn to Code
John F. Dumas
contact me | resume | how it works | example programs | testimonials | main page

PHP - More Popular Titles


► Problem Description: Using the files created in problem four, we now want to output the following information:

  1. The top 20 titles overall, ordered from highest to lowest rating. Only include titles rated by at least 500 people.

  2. For each decade: 1930, 1940, 1950, 1960, 1970, 1980, 1990 and 2000, show the top 5 titles from that decade. As above, only consider titles rated by at least 500 people and show the titles ordered from highest to lowest rating.

Here's what the first few rows of output for part (1) might look like:


► Example Output: Here's what the output should look like.

Top 20 Titles

Rating Year Title
5.00 1957 Witness for the Prosecution
4.73 2003 Lord of the Rings: The Return of the King: Extended Edition
4.72 2002 Lord of the Rings: The Two Towers: Extended Edition
4.72 1962 To Kill a Mockingbird
4.71 2001 The Lord of the Rings: The Fellowship of the Ring: Extended Edition
4.67 1972 The Godfather
4.66 1954 Rear Window
4.64 1981 Raiders of the Lost Ark
4.62 1993 Schindler's List
4.60 1957 12 Angry Men
4.58 1959 North by Northwest
4.57 1974 The Godfather, Part II
4.56 1994 The Shawshank Redemption: Special Edition
4.54 1950 All About Eve
4.54 1954 Dial M for Murder
4.53 1941 The Maltese Falcon
4.53 1977 Star Wars: Episode IV: A New Hope
4.52 1957 The Bridge on the River Kwai
4.52 2000 The Sopranos: Season 2
4.51 1939 The Wizard of Oz: Collector's Edition

Top 5 Titles, Decade: 1930

Rating Year Title
4.51 1939 The Wizard of Oz: Collector's Edition
4.49 1939 Gone with the Wind: Collector's Edition
4.46 1939 Mr. Smith Goes to Washington
4.45 1934 The Thin Man
4.39 1934 It Happened One Night

Top 5 Titles, Decade: 1940

Rating Year Title
4.53 1941 The Maltese Falcon
4.50 1946 Notorious
4.47 1941 Citizen Kane
4.46 1940 The Grapes of Wrath
4.46 1948 The Treasure of the Sierra Madre

Top 5 Titles, Decade: 1950

Rating Year Title
5.00 1957 Witness for the Prosecution
4.66 1954 Rear Window
4.60 1957 12 Angry Men
4.58 1959 North by Northwest
4.54 1950 All About Eve

Top 5 Titles, Decade: 1960

Rating Year Title
4.72 1962 To Kill a Mockingbird
4.49 1962 Lawrence of Arabia
4.47 1961 Judgment at Nuremberg
4.47 1960 Inherit the Wind
4.45 1960 Psycho

Top 5 Titles, Decade: 1970

Rating Year Title
4.67 1972 The Godfather
4.57 1974 The Godfather, Part II
4.53 1977 Star Wars: Episode IV: A New Hope
4.48 1973 The Sting
4.46 1975 One Flew Over the Cuckoo's Nest

Top 5 Titles, Decade: 1980

Rating Year Title
4.64 1981 Raiders of the Lost Ark
4.51 1980 Star Wars: Episode V: The Empire Strikes Back
4.38 1981 Das Boot
4.38 1982 Gandhi
4.37 1989 Indiana Jones and the Last Crusade

Top 5 Titles, Decade: 1990

Rating Year Title
4.62 1993 Schindler's List
4.56 1994 The Shawshank Redemption: Special Edition
4.44 1995 Pride and Prejudice
4.44 1999 The Sopranos: Season 1
4.40 1995 The Usual Suspects

Top 5 Titles, Decade: 2000

Rating Year Title
4.73 2003 Lord of the Rings: The Return of the King: Extended Edition
4.72 2002 Lord of the Rings: The Two Towers: Extended Edition
4.71 2001 The Lord of the Rings: The Fellowship of the Ring: Extended Edition
4.52 2000 The Sopranos: Season 2
4.51 2003 Lord of the Rings: The Return of the King


Source Code


Back to Example Program Index


© John F. Dumas | johnfdumas@gmail.com | main page | top of page