Question: I need help on Java Nitro 5.8.9 Broken Calculator! Ive been working on this for a while and I still dont know what I have
I need help on Java Nitro 5.8.9 Broken Calculator! Ive been working on this for a while and I still dont know what I have to fix to make the Calculator work



5 points Status: Not Submitted For this exercise, we are going to take a look at an alternate Calculator class, but this one is broken. There are several scope issues in the calculator class that are preventing it from running. Your task is to fix the calculator class so that it runs and prints out the correct results. The CalculatorTester is completed and should function correctly once you fix the Calculator class. Status: Not Submitted 5.8.9: Broken Calculator Save Submit + Continue ili FILES Calculator.java CalculatorTester.java 1. public class Calculator { 2 3 private int total; 4 private int value; 5 6- public Calculator(int startingValue) { 7 int total = startingValue; 8 value = 0; 9 } 10 11 - public int add(int value) { 12 int total = total + value; 13 return total; 14 } 15 16 17 * Adds the instance variable value to the total 18 19- public int add() { 20 int total += value; 21 return total; 22 } 23 24- public int multiple(int value) { 25 int total *= value; 26 return total; 27 } 28 29- public void setValue(int value) { 30 value = value; 31 } 32 33- public int getValue() { 34 return value; 35 } 36 37 } 38
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
