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

  The sequence control structure

1. the sequence control structure and the selection control structure?

  Show how an assembly might replace

show how an assembly might replace this pseudo-instruction with the true instructions to achieve the same effect. You solution must observe MIPS register use conventions.

  Identify three operational applications for airlines company

For an airlines company, identify three operational applications that would feed into the data warehouse. What would be the data load and refresh cycles for each

  Compare how the gestures data is generated and represented

Analyze the accuracy of the input generated by each of the following input devices compared to electrical signals based methods of processing

  Benefits of a web-based computing environment

Web-based computing so for this essay question, explain in scholarly detail benefits of a Web-based computing environment.

  What is the value of v_flag

What is the value of v_flag when the following PL/SQL block is executed successfully?

  How many rows will a truth table require

How many rows will a Truth Table require if there are six variables and three conditions of each variable? Defend your answer.

  Determine the size and contents

Determine the size and contents of: e=1:-1:5;

  Display the most frequently occurring word

the program should count how many times each word appears and display the most frequently occurring word, along with how many times it occurs.

  Explain about how device works

Write down what first comes to mind as to what is good and bad about the way the device works. The range of tasks a typical user would want to do using it.

  Cultural factors contribute to success of nanotechnology

What is the Nanotechnology, and identify the cultural factors that may contribute to the success or failure of this technology.

  Create flowchart and psuedo code for math program

Create flowchart and psuedo code for math program which permits the user to enter two separate numbers and choose one of four mathematical operations (add, subtract, mutiply, divide).

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