NETS 150 - Homework 3: Part 1 - Theory (20 Points)
NETS 150 - Homework 3: Part 1 - Theory (20 Points)
150 – Homework 3
Due – Apr 2, 2019 at 12.00pm
Paper Programs – Exercise 3 below requires a paper program. You can submit this as part of your theory
writeup. This program does not need to be a separate Java file or compiled, executed, debugged, etc.
Computer generated code will earn no extra credit and will have no effect on your grade.
1. What is a socket? What is the difference between a Socket object and a ServerSocket
object in Java? (5 points)
2. What happens if the Socket constructor’s second parameter is not the same as the port
number at which the server waits for connections? (5 points)
3. Paper Program – modify the Client Server code from class (posted in canvas) to that it supports
basic Math. The client should be able to send the server the following commands: ADD X Y, MUL
X Y. X and Y can be any 2 integers. The server should do the math and return the answer to the
client. (10 points)
Wikipedia has a lot of information on a wide variety of topics. For this assignment, we’ll focus on movies
and in particular, the most recent Oscars. You can find the 91st Oscars page on Wikipedia here
https://en.wikipedia.org/wiki/91st_Academy_Awards
For this assignment, you’ll write a program in Java to get and analyze data from Wikipedia. You should
not download any of the information to a local file and read from it. Your program must interact directly
with the website. (This way your programs will work even when the Wikipedia updates the pages.)
Once you have a basic program that can interact with the Wikipedia pages, use it to answer the
following questions. Describe in detail the algorithm you used and the answers in your readme.txt file.
1. How many awards was Alfonso Cuarón nominated for? List them.
2. List all the movies that were nominated for at least 3 awards.
3. When was the award for Best Actress first awarded? Who won the award that year?
4. What was the budget for the Best Original Screenplay winner? How much did this movie make in
the box office?
5. Which of the nominees for Best Documentary – Feature has the shortest running time?
6. Which company distributed the most films that received multiple nominations?
7. For Best Foreign Language Film, for the countries that were nominated/won, how many times
have they been nominated in the past (including this year)?
8. Wild card – come up with an interesting question. List the question and find the answer to it.
Note: For the italicized and underlined parts in the above, your code should be able to deal with any
similar input (e.g., from a user). This should not be hard coded.
Please create a class that has a main method (in addition to any other classes that you create). This
should ask the user which question they want to answer, take in the italicized input, and print the
answers.
Hint: There are broadly three options (or any combination therein) here:
Hint 2: To ensure that your program doesn’t violate Wikipedia’s Terms of Service, please see Wikipedia’s
robots.txt file (http://en.wikipedia.org/robots.txt) and here’s a Wikipedia article on what the robots.txt
file means http://en.wikipedia.org/wiki/Robots_exclusion_standard.
1. Which country had the Best Original Song winner in 2019 furthest down on its weekly charts?
What was the exact position on this chart?
2. The most prestigious awards at the Oscars are the Best Picture, Best Director, Best Actor, and
Best Actress. Were any movies nominated for all 4 of these awards in 2019? What about in all
the years that the Oscars ceremonies were held so far?
For the EC part, you cannot have any help from the TAs/instructor.
Grading Criteria (for the programming part)
10% for compilation – If your code compiles, you get full credit. If not, you get a 0.
70% for functionality – Does the code work as required? Does it crash while running? Are there bugs? …
10% for design – Is your code well designed? Does it handle errors well? Do you have a lot of URLs
hardcoded? To keep your code flexible, you should hardcode as few URLs as possible in the code.
10% for style – Do you have good comments in the code? Are your variables named appropriately? …
You can also install the Checkstyle plugin (http://eclipse-cs.sourceforge.net/) in Eclipse, which will
automatically warn you about style violations.
Submission Instructions
We recommend submitting the theory part electronically also. However, you can turn in a physical copy
at the start of class, if you prefer. The code should be submitted electronically. Please do not print it out.
In addition to the Java files (and the theory writeup), you should also submit a text file titled readme.txt,
which should contain a short write-up about your software. How to run your program, any problems you
experienced, etc. Think of the readme as a combination of instructions for the user and a chance for you
to get partial credit.
Please create a folder called YOUR_PENNKEY. Places all your files inside this – the java files, theory
writeup, the readme.txt file. Zip up this folder. It will thus be called YOUR_PENNKEY.zip. So, e.g., my
homework submission would be swapneel.zip. Please submit this zip file via canvas.