Ask Question
29 November, 17:30

An instance variable name of type String, initialized to the empty String. An instance variable score of type int, initialized to zero. A method called setName that has one parameter, whose value it assigns to the instance variable name. A method called setScore that has one parameter, whose value it assigns to the instance variable score. A method called getName that has no parameters and that returns the value of the instance variable name. A method called getScore that has no parameters and that returns the value of the instance variable score.

+2
Answers (1)
  1. 29 November, 18:48
    0
    public class Class {

    private String name = "";

    private int score = 0;

    //Method SetName

    public void setName (String newName) {

    name = newName;

    }

    //Method SetScore

    public void setScore (int newScore) {

    score = newScore;

    }

    //Method GetName

    public String getName () {

    return name;

    }

    //Method GetScore

    public int getScore () {

    return score;

    }

    }

    Explanation:

    The class called Class is implemented in Java programming language It has two fields (instance variables name and score) Methods for setting the values of variables (mutator methods) or setters Methods for getting the values of the variables (accessor methods) getters
Know the Answer?
Not Sure About the Answer?
Get an answer to your question ✅ “An instance variable name of type String, initialized to the empty String. An instance variable score of type int, initialized to zero. A ...” in 📙 Computers & Technology if there is no answer or all answers are wrong, use a search bar and try to find the answer among similar questions.
Search for Other Answers