Implement the class with accessors and mutators

Assignment Help Basic Computer Science
Reference no: EM13307576

Consider a class Movie that contains information about a movie. The class has the following attributes:

  • The movie name
  • The MPAA rating (e.g. G, PG, PG-13, R)
  • The number of people that have rated this movie as a 1 (Terrible)
  • The number of people that have rated this movie as a 2 (Bad)
  • The number of people that have rated this movie as a 3 (OK)
  • The number of people that have rated this movie as a 4 (Good)
  • The number of people that have rated this movie as a 5 (Great)

Implement the class with accessors and mutators for the movie name and MPAA rating. Write a method addRating that takes an 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 the 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. Write another method, getAverage, that returns the average value for all the movie ratings.

Test the class by writing a main method that creates at least two movie objects, adds at least five ratings for each movie, and output the movie name, MPAA rating, and average rating for each movie object.

 

Reference no: EM13307576

Questions Cloud

Write a java program that declares an array alpha : Initialize the array so that the first 25 elements of array are equal to the square of the index variable, and the last 25 elements are equal to three times the index variable. Output the array so that 10 elements per line are printed on the conso..
What is force necessary to pull the loop : A loop of width 0.2m and length 0.8m, and resistance 200ohms is pulled through a magnetic field of 0.4 T at 0.2 m/sec. What is force necessary to pull the loop
Determine what manometer reading can be expected : Is this flow laminar. What is the viscosity of the oil. For the same flow in the opposite directio, what manometer reading can be expected.
How will this policy-change affect outpatient care market : How will this policy-change affect outpatient care market and what will be effect of this hospital admission reviews on the insurance market?
Implement the class with accessors and mutators : Implement the class with accessors and mutators for the movie name and MPAA rating. Write a method addRating that takes an integer as an input parameter.
What is the speed of the other train : Two trains are moving in opposite directions on parallel tracks and are approaching a station. What is the speed of the other train if an observer at the station hears a beat frequency of 4.4Hz
Write an xeyes command to display a window : Find and install xeyes (not tuxeyes). Write an xeyes command to display a window that is 600 pixels wide and 400 pixels tall, is located 200 pixels from the right edge of the screen and 300 pixels from the top of the screen.
Determine the height between the basement and seventh floor : The pressure in a water pipe in the basement of an apartment house is 4.10x10^5 Pa, determine the height between the basement and the seventh floor
Determine the maximum detector spacing by drawing : Imagine a virtual expressway having 3 lanes. The administrating agency wants to detect traffic accidents in 5 minutes wherever they occur to dispatch an emergency response unit.

Reviews

Write a Review

Basic Computer Science Questions & Answers

  A disadvantage of the content of approach for lans

A disadvantage of the content of approach for LANs, such as CSMA/CD, is the capacity wasted due to multiple stations attempting to access the channel at the same time. Suppose that time is divided into discrete slots, with each of N stations attempti..

  Explain professional responsibility to complete installation

You are an engineer involved in the development of a financial system. During installations, you discover that this system will make a significant number of people redundant. It is your professional responsibility to complete the installation as..

  How long will it take for input size

How long will it take for input size 500 if the running time is the following

  Plan for processing the potential crime incident scene

Describe your plan for processing the potential crime/incident scene. Some of the items you will want to cover include

  Which structure best for the storyboard created

Case 2-3 Michael wants to create a Website based on his famous cooking show. He would like to provide instructions on how to create some of his favorite dishes. He would like his recipes to be displayed in very simple, step by step pages. Which st..

  Why ratings for high quality pages must all get same rating

Ratings for high quality pages should all get the same rating. For example, a high quality page for a common interpretation of the query should get the same rating as a high quality page for a minor interpretation of the query.

  Trust and deception

Trust and Deception

  Create an object-oriented java web application

Create an object-oriented Java Web application that: a. displays the entire product inventory to the screen, including the product ID, name, description, and quantity. b. allows for a product to be searched by the product ID or product name.

  16-bit signed magnitude numbers

Convert the following numbers to 16-bit signed magnitude numbers (display results in hexadecimal):

  What ''are the differences between a policy, a standard

What 'are the differences between a policy, a standard, and a practice? What are the three types of security policies? Where would each be used? What type of policy would be needed to guide use of the Web? E-mail? Office equipment for personal use?

  What is the syntax of the inheritance method

What is the syntax of the Inheritance method to extending a base class in C++

  Explain activities of business modeling discipline

Activities of business modeling discipline study the information needs of user, the ways in which those requirements are being.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd