java short assignment
Assignment 3
TCSS 143 Programming Assignment 3
Due: see canvas, by 11:55pm (submitted electronically). NOTE: Be sure to adhere to the University’s Policy on Academic Integrity as discussed in class. Programming assignments are to be written individually and submitted programs must be the result of your own efforts. Any suspicion of academic integrity violation will be dealt with accordingly Purpose: The purpose of this programming project is to apply concepts of Object-Oriented Programming and work with Recursion. There are 2 problems that need to be solved as part of this assignment.
Program compiles 15 Points Documentation Java Docs for Problem 1 10 Points Process
Problem 1 50 Points o Fields, Constructor, Methods (Movie.java) 15 Points o Handling Exceptions 10 Points o Test.java implementation 15 Points o Output 10 Points Problem 2 25 Points o Practice-It Problems
Total 100 Points
Assignment 3
Problem 1: Movie ADT You have been hired to an inventory system for movies that will allow the user to add, remove, and search for movies in the collection. In this exercise, you will complete and test an initial implementation of the Movie ADT that will be the heart of this inventory system. Step 1: Movie.java Create a class file Movie.java based on the description provided in the class diagram given below:
Step 2: Implementation of the compareTo() method We have discussed the Comparable interface in class and we have seen some methods in the Collection interface and Collections class that use the compareTo() method. What would be a good method for determining whether one movie is less than, equal to, or greater than another movie? This is called the “Natural” ordering for the movie ADT. Implement your compareTo() method. Step 3: Exception Handling
• The constructor should throw a java.lang.NullPointerException if title is null and a java.lang.IllegalArgumentException if year is negative.
• equals() & compareTo() methods should throw a java.lang.NullPointerException if its argument is null.
Step 4: Test.java A driver file Test.java has been provided with the Assignment. You will modify the driver program to perform the following steps:
1. Instantiate eight objects of type Movie and add them to the movie List. 2. Print out the unsorted list of movies. 3. Sort the list of movies using Collections.sort(). 4. Print out the sorted list of movies. 5. Search for a particular movie in the list using Collections.binarySearch() 6. Test your equals method.
Assignment 3
Problem 2: Based on Practice-It Do the following exercises from Practice-It:
• University of Washington CSE 143 (CS2) (Under) Recursion Tracing:
a. mystery2 b. mystery3 c. mystery7
• University of Washington CSE 143 (CS2) (Under) Recursion:
a. factorial b. writeChars c. stutter d. countToBy e. printRange
Submission Guidelines:
1. Problem 1 a. Movie.java b. Test.java
2. Problem 2 a. One document showing the results from Practice-It problem. Check the “Practice It Handing
Procedure” for instructions on saving the results from Practice-It. 3. Zip the above-mentioned files and upload it to the submission link for Assignment 3.