Advertisement
akosiraff

Movie JAVA

Oct 14th, 2013
248
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.34 KB | None | 0 0
  1.  
  2. Download: http://solutionzip.com/downloads/movie-java/
  3. In this lab we will continue to gain familiarity with creating and using classes. We will be creating a new class that contains information about a movie and will allow us to utilize our knowledge of accessor and mutator methods. We will also practice using Javadoc to create documentation.
  4. Following the completion of the program you should be able to:
  5. Identify the attributes a real world object and use them to create a Java class
  6. Practice the writing of accessor and mutator methods.
  7. Create a test program to implement our object class.
  8. Practice creating and modifying static variables.
  9. Use Javadoc to create documentation.
  10. Programming Problem:
  11. Consider a class Movie that contains information about a movie. The class has the following attributes:
  12. The movie name
  13. The MPAA rating (e.g. G, PG, PG-13, R)
  14. The number of people that have rated this movie as a 1 (Terrible)
  15. The number of people that have rated this movie as a 2 (Bad)
  16. The number of people that have rated this movie as a 3 (OK)
  17. The number of people that have rated this movie as a 4 (Good)
  18. The number of people that have rated this movie as a 5 (Great)
  19. Part 1:
  20. Implement the class with accessors and mutators for the movie name and MPAA rating.
  21. Write a method addRating that takes and integer as an input parameter. The method should verify that the parameter is a number between 1 and 5, and if so, increment by one the number of people rating that movie that matches the input parameter. For example, if 3 is the input parameter, then the number of people that rated the movie as a 3 should be incremented by one.
  22. Write another method, getAverage, that returns the average value for all of the movie ratings.
  23. Part 2:
  24. Test the class by writing a MovieTest class that creates at least three movie objects, adds at least five ratings for each movie, and outputs the movie name, MPAA rating, and average rating fore each movie object.
  25. Sample run:
  26. The Adjustment Bureau, PG-13 Average rating: 4.4
  27. Ice Age, G Average rating: 5.6
  28. Cabin Fever, R Average rating: 2.0
  29. Part 3:
  30. Use javadoc to generate documentation for your code. Use the @author tag in the description of the entire class. Add a comment for every public method or constructor using the @param and @return tags when appropriate.
  31.  
  32. Download: http://solutionzip.com/downloads/movie-java/
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement