Ask Question
21 May, 18:04

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.

+4
Answers (1)
  1. 21 May, 20:58
    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?
Find 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 and Technology if you're in doubt about the correctness of the answers or there's no answer, then try to use the smart search and find answers to the similar questions.
Search for Other Answers