Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6689989
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T05:35:04+00:00 2026-05-26T05:35:04+00:00

Task at hand:Consider a class ratingScore that represents a numeric rating for some thing

  • 0

Task at hand:Consider a class ratingScore that represents a numeric rating for some thing such as a move. Attributes: A description of what is being rated, The maximum possible rating, rating.

It will have methods to: get rating from ta user, Return the maximum rating posisble, return the rating, return a string showing the rating in a format suitable for display.

a. write a method heading for each method
b. write pre and post conditions for each method
c. write some java statements to test the class
d. implement the class.

I think i did what i was supposed to do, but it is a method and i am not sure that i put enough room for it to be changed much, this is what i have so far.

import java.util.*;
public class MovieRating 
{
    // instance variables
    private String description = " A movie that shows how racism affect our lives and choices";
    private int maxRating = 10;
    private int rating;

    // methods 

    //precondition: Must have maxRating, rating and description before you post it back to the user.
    //rating between 1 and 10, maxRating is set to 10, description of a movie
    public void writeOutput()
    {
        System.out.println("The max rating is: " + maxRating );
        System.out.println("Your rating is: " + rating );

        System.out.println("The rating for" + description + " is " + rating); 
        System.out.println("while the max rating was " + maxRating);
    }

    // PostCondition: Will write maxRating, rating and description to the user.

    //Precondition: description, enter the rating
    public void readInput()
    {
        Scanner keyboard = new Scanner(System.in);
        System.out.println("What would you rate the movie \"American History x\" out of ten");
        System.out.println(description);
        rating = keyboard.nextInt();
    }
    //postcondition: rating will be set to user's input for the movie American History x.



}

This is my Tester program.. not much so far

public class MovieRatingTester 
{
    public static void main(String[] args)
    {

        //object of the class MovieRating
        MovieRating rating1 = new MovieRating();

        rating1.readInput();

        rating1.writeOutput();

    }

}

SO did i cover what was told to cover? i think i did but i think i did it the wrong way, let me know please.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T05:35:04+00:00Added an answer on May 26, 2026 at 5:35 am

    Ok, my point of view is:

    Your class, MovieRating is missing some basic elements of OOP, and that is what I think you suppose to learn in this homework.

    The first element missing is a constructor method, what you did is automatically assigning each new MovieRating the same description. The job of the constructor function is giving a unique values to the Object when it first built in the system.

    The constructor method is special, it is public and has the exact same name is the class, as we said, in this method you suppose to assign values to your object variables.

    the second thing will be to put getters/setters, these are methods who has access to your private values and will be used to assign/get the values from them. Note the use of them in the code:

    import java.util.*;
    public class MovieRating 
    {
    
    // instance variables
    private String description;
    private int maxRating;
    private int rating;
    
    /*This is the constructor
      Note the use of .this - the expression is used to call the class form withing  
      itself*/
    public MovieRating(String description, int maxRating, int rating) {
        this.setDescription(description);
        this.setMaxRating(maxRating);
        this.setRating(rating);
    }
    
    /*These are the getters and setters - get is used for getting the value
      and set is used for assigning a value to it*/
    public String getDescription() {
        return description;
    }
    
    public void setDescription(String description) {
        this.description = description;
    }
    
    public int getMaxRating() {
        return maxRating;
    }
    
    public void setMaxRating(int maxRating) {
        this.maxRating = maxRating;
    }
    
    public int getRating() {
        return rating;
    }
    
    public void setRating(int rating) {
        this.rating = rating;
    }
    
    //This is a method for the printing commands - notice the use of the get methods//
    public void printRatings()
    {
        System.out.println("The max rating is: " + this.getMaxRating() );
        System.out.println("Your rating is: " + this.getRating() );
    
        System.out.println("The rating for" + this.getDescription() + " is " + 
                            this.getRating()); 
        System.out.println("while the max rating was " + this.getMaxRating();
        }
    
    // PostCondition: Will write maxRating, rating and description to the user.
    
    /*Precondition: description, enter the rating
      Note the use of this.setRating()*/
    public void readInput()
    {
        Scanner keyboard = new Scanner(System.in);
        System.out.println("What would you rate the movie \"American History x\" out of ten");
        System.out.println(description);
        this.setRating(keyboard.nextInt());
    }
    //postcondition: rating will be set to user's input for the movie American History x.
    

    }

    Using the constructor, you can create a different rating from your tester program

    MovieRating rating1 = new MovieRating("description 1", 10, 5);
    MovieRating rating2 = new MovieRating("description 2", 9, 7);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Task at hand is to move data as shown in table 1 to that
Task at hand — I have three versions of some code, developed by different
I've got the beautiful task at hand to look at some nice legacy asp.net
I have a task at hand of creating some kind of logic for a
I have a task in hand that requires me to send a form to
I am new this sharepoint development and i have task in hand to do
Let's say we have a very processor-intensive task at hand which could be effectively
Unfortunately I inherited some code (c/c++) that does some string manipulation and now I
I'm trying my hand at Euler Problem 4 in Haskell. It asks for that
I have a very simple task at hand. If the last time a record

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.