Fill in Order Details

  • Submit paper details for free using our simple order form

Make Payment Securely

  • Add funds to your account. There are no upfront payments. The writer will only be paid once you have approved your paper

Writing Process

  • The best qualified expert writer is assigned to work on your order
  • Your paper is written to standard and delivered as per your instructions

Download your paper

  • Download the completed paper from your online account or your email
  • You can request a plagiarism and quality report along with your paper

programming abstraction methods

Problem

In the file imdb.py, write program that:

  1. Reads a file containing movie information, and stores the information in appropriate data structures, which are specified further in this document. (You will only store the information from the file that is relevant to answering questions of the form described above.)
  2. Reads in from the user (with a prompt) the name of an actor or actress.
  3. Determines the actor or actress who has appeared in the most movies with the named actor/actress, and prints out the result.
  4. Prompts the user again for the name of another actor/actress. The program continues until the user enters an empty string in response to the prompt.

Your program should behave exactly as shown further down in this problem statement. That is, the wording and spacing of what is printed by your program should be the same as shown below.

The dataset files maintained by the IMDb are very large and somewhat tedious to read, so you will be working with a single smaller file, named “imdb_data.csv” that contains information on about 10000 popular movies released since around 1960. The information includes the names of the movies and the principle actors/actresses in them.

“imdb_data.csv” is (as the extension implies), a csv (comma separated value) file. csv files are plain text files that can be viewed with a plain text editor. Each record in a csv file is contained on a separate line, and the fields in a line are separated by commas. Fields containing commas must be escaped. This is typically done by embedding the field inside of double quotes. The first line of a csv file typically contains the labels of the fields. You can view a csv file using a spreadsheet program, like Excel, or Numbers (on a Mac).

The first line of “imdb_data.csv” contains the labels of the fields, and fields containing commas are embedded in double quotes. I suggest that you open “imdb_data.csv” with a spreadsheet program and look at the fields. For purposes of this PSA, the only fields you need to be concerned with are the “original_title” field and the “cast” field. (Note that even with the limited information presented in this file, there are lots of interesting questions you can pose about the data. This PSA has you answering just one such question.)

Since a csv is a plain text file, having your program read it should be straightforward, but there is one complication – those embedded commas within a field. If you read a line into a string, and use the python split method to break it into fields (using the comma as the separator character), you will break some fields into multiple fields. With some careful programming, you can get around this problem, but it is tedious. To avoid this tedium, you can (and you will) let the python module csv handle reading from a csv file for you. Since it is good practice for you to learn to read documentation, I refer you to https://docs.python.org/3/library/csv.html#csv-fmt… to learn about how to use the csv module to read a csv file. You can also Google the topic to find tutorials on it.

The program you write should behave (the wording of what it prints, including space characters) exactly as illustrated in this sample run:

Enter a name: Jennifer Lawrence_x000D_
4 actor(s) have been in 4 common movies with Jennifer Lawrence.  They are:_x000D_
    Bradley Cooper:_x000D_
      American Hustle_x000D_
      Joy_x000D_
      Serena_x000D_
      Silver Linings Playbook_x000D_
_x000D_
    Josh Hutcherson:_x000D_
      The Hunger Games_x000D_
      The Hunger Games: Catching Fire_x000D_
      The Hunger Games: Mockingjay - Part 1_x000D_
      The Hunger Games: Mockingjay - Part 2_x000D_
_x000D_
    Liam Hemsworth:_x000D_
      The Hunger Games_x000D_
      The Hunger Games: Catching Fire_x000D_
      The Hunger Games: Mockingjay - Part 1_x000D_
      The Hunger Games: Mockingjay - Part 2_x000D_
_x000D_
    Woody Harrelson:_x000D_
      The Hunger Games_x000D_
      The Hunger Games: Catching Fire_x000D_
      The Hunger Games: Mockingjay - Part 1_x000D_
      The Hunger Games: Mockingjay - Part 2_x000D_
_x000D_
Enter a name: Emma Watson_x000D_
2 actor(s) have been in 8 common movies with Emma Watson.  They are:_x000D_
    Daniel Radcliffe:_x000D_
      Harry Potter and the Chamber of Secrets_x000D_
      Harry Potter and the Deathly Hallows: Part 1_x000D_
      Harry Potter and the Deathly Hallows: Part 2_x000D_
      Harry Potter and the Goblet of Fire_x000D_
      Harry Potter and the Half-Blood Prince_x000D_
      Harry Potter and the Order of the Phoenix_x000D_
      Harry Potter and the Philosopher's Stone_x000D_
      Harry Potter and the Prisoner of Azkaban_x000D_
_x000D_
    Rupert Grint:_x000D_
      Harry Potter and the Chamber of Secrets_x000D_
      Harry Potter and the Deathly Hallows: Part 1_x000D_
      Harry Potter and the Deathly Hallows: Part 2_x000D_
      Harry Potter and the Goblet of Fire_x000D_
      Harry Potter and the Half-Blood Prince_x000D_
      Harry Potter and the Order of the Phoenix_x000D_
      Harry Potter and the Philosopher's Stone_x000D_
      Harry Potter and the Prisoner of Azkaban_x000D_
_x000D_
Enter a name: amy adams_x000D_
1 actor(s) have been in 3 common movies with amy adams.  They are:_x000D_
    Philip Seymour Hoffman:_x000D_
      Charlie Wilson's War_x000D_
      Doubt_x000D_
      The Master_x000D_
_x000D_
Enter a name: Gwyneth Paltrow        _x000D_
2 actor(s) have been in 3 common movies with Gwyneth Paltrow.  They are:_x000D_
    Jude Law:_x000D_
      Contagion_x000D_
      Sky Captain and the World of Tomorrow_x000D_
      The Talented Mr. Ripley_x000D_
_x000D_
    Robert Downey Jr.:_x000D_
      Iron Man_x000D_
      Iron Man 2_x000D_
      Iron Man 3_x000D_
_x000D_
Enter a name: John Doe_x000D_
John Doe is not a known actor_x000D_
_x000D_
Enter a name: moRgaN FReEmAn_x000D_
1 actor(s) have been in 4 common movies with Morgan Freeman.  They are:_x000D_
    Ashley Judd:_x000D_
      Dolphin Tale_x000D_
      Dolphin Tale 2_x000D_
      High Crimes_x000D_
      Kiss the Girls_x000D_
_x000D_
Enter a name: 

Some things to note about how your program must work:

  1. If multiple actors have appeared in the most common movies with the query actor, then all of those actors must be listed.
  2. For each actor that has appeared in the most common movies with the query actor, all common movies must be listed.
  3. Actor names in the database file are capitalized (first letter uppercase, remaining letters lowercase), but when entering a query, the user can enter the letters of the name in any case, and your program should find the actor. (For examples, see the queries for Amy Adams and Morgan Freeman above.)
  4. If multiple actors have appeared in the most movies with an actor, then those actors should be listed in lexicographic order of their names. (For examples, see the queries above except Amy Adams and Morgan Freeman.) (A lexicographic ordering is like the ordering of words in a dictionary.
    In Python, the relational operators, like <, give the lexicographic order of strings. So if you have two strings s1 and s2, and if s1 < s2, then s1 appears before s2 in a lexicographic ordering. This means that if you have a list of strings in Python, and you sort it, then they will be put in lexicographic order.)
  5. The common movies an actor has with the query actor should be listed in lexicographic order. (As illustrated by all of the examples above.)
  6. The wording and spacing in the output of your program must be exactly as illustrated in the examples above. I will be testing your programs with software, and any deviations from the output shown above will cause your output to be flagged as incorrect. The imdbtest.py program included in the repository will check the output of your program. Make sure all test cases are flagged as correct.

The program you write should conform to the following requirements:

  1. The name of the file containing your program should be imdb.py. The repository contains this file, and this file contains some starter code, which you should not modify.
  2. It should take one command line argument that is the name of the csv file containing the movie information. The starter code in imdb.py reflects this requirement.
  3. It should contain the definitions of a Movie class and an Actor class.
  4. The instance variables of the Movie class should be the name of the movie, and a list of actors who appear in the movie. This actor list should be a list of Actor objects, and not a list of Actor names.
  5. The instance variables of the Actor class should include the name of the actor, and a list of movies that the actor has appeared in. This movie list should be a list of Movie objects, and not a list of movie names. You may want to add additional instance variables to support a user query.
  6. It should contain the definition of a Imdb class. The instance variables of this class should be:
    • a dictionary of movies, where the keys are the names of movies, and the values are the Movie objects.
    • a dictionary of actors, where the keys are the names of actors, and the values are the Actor objects.
  7. The Imdb class should have a run method that reads in from the user (with prompting) the name of an actor/actress, and calls another method query with that name as parameter. query should return a string representation of the result of the query, which run should print out. run continues to prompt the user for actor names, until the user enters an empty string in response to the prompt.
  8. The query method of the Imdb class should be as efficient as possible (in terms of running time).

Why store information about movies and actors in dictionaries? Because storing a new value in a dictionary and looking up a key in a dictionary are constant time operations, and you need that efficiency when building your data structures, especially when the database file is large.

WHAT OUR CURRENT CUSTOMERS SAY

  • Google
  • Sitejabber
  • Trustpilot
Zahraa S
Zahraa S
Absolutely spot on. I have had the best experience with Elite Academic Research and all my work have scored highly. Thank you for your professionalism and using expert writers with vast and outstanding knowledge in their fields. I highly recommend any day and time.
Stuart L
Stuart L
Thanks for keeping me sane for getting everything out of the way, I’ve been stuck working more than full time and balancing the rest but I’m glad you’ve been ensuring my school work is taken care of. I'll recommend Elite Academic Research to anyone who seeks quality academic help, thank you so much!
Mindi D
Mindi D
Brilliant writers and awesome support team. You can tell by the depth of research and the quality of work delivered that the writers care deeply about delivering that perfect grade.
Samuel Y
Samuel Y
I really appreciate the work all your amazing writers do to ensure that my papers are always delivered on time and always of the highest quality. I was at a crossroads last semester and I almost dropped out of school because of the many issues that were bombarding but I am glad a friend referred me to you guys. You came up big for me and continue to do so. I just wish I knew about your services earlier.
Cindy L
Cindy L
You can't fault the paper quality and speed of delivery. I have been using these guys for the past 3 years and I not even once have they ever failed me. They deliver properly researched papers way ahead of time. Each time I think I have had the best their professional writers surprise me with even better quality work. Elite Academic Research is a true Gem among essay writing companies.
Got an A and plagiarism percent was less than 10%! Thanks!

ORDER NOW


Consider Your Assignments Done

“All my friends and I are getting help from eliteacademicresearch. It’s every college student’s best kept secret!”

Jermaine Byrant
BSN

“I was apprehensive at first. But I must say it was a great experience and well worth the price. I got an A!”

Nicole Johnson
Finance & Economics

Our Top Experts

See Why Our Clients Hire Us Again And Again!


OVER

10.3k
Reviews

RATING
4.89/5
Average

YEARS
13
Mastery

Success Guarantee

When you order form the best, some of your greatest problems as a student are solved!

Reliable

Professional

Affordable

Quick

Using this writing service is legal and is not prohibited by any law, university or college policies. Services of Elite Academic Research are provided for research and study purposes only with the intent to help students improve their writing and academic experience. We do not condone or encourage cheating, academic dishonesty, or any form of plagiarism. Our original, plagiarism-free, zero-AI expert samples should only be used as references. It is your responsibility to cite any outside sources appropriately. This service will be useful for students looking for quick, reliable, and efficient online class-help on a variety of topics.