Questions needing answering related to this code: 1) How many instance variables
ID: 3810246 • Letter: Q
Question
Questions needing answering related to this code:
1) How many instance variables does this class contain?
2)Which variable in the constructor is being updated by a parameter?
3)How many methods are there in this class
4)How many methods are 'mutators'?
5)What do you think the primary purpose is of this class?
6)Write the java method call that would add a quiz score of 95?
7)Which methods do/does not return a value?
8)If we wanted each score to count two times, which method needs to be modified?
9)Can quiz scores with decimals be entered?
Explanation / Answer
1) This class contains 3 instance variables
2) name variable is updated using n parameter in constructor
3) There are totally five methods in this class including constructor
4) mutators are setter methods - There are no mutators in this class
5) The primary purpose of thsi class is to hold information about the number of quizes answered and scores earned by that Student along with the Student's name.
6) Student stud = new Student("James");
stud.addQuiz(95);
7) The constructor and addQuiz() methods do not return any value.
8) The change needs to be done in addQuiz() method
9) Yes. The data type of totalScore is double. Hence score can be a double also.
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.