Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Please help with this code. Use java Create the initial version Create the package cse360assign2 Copy the file Calculator.java to this package. Document this file
Please help with this code. Use java
Create the initial version Create the package cse360assign2 Copy the file Calculator.java to this package. Document this file using the Javadoc comment style but do not make any code changes to the file at this time. Most of the methods are blank Make the following changes to the Calculator class a. c. i. ii. iii. iv. V. The add method should add the parameter to the total variable The subtract method should subtract the parameter from the total variable The getTotal method should return the current total The multiply method should multiply the total by the parameter The divide method should divide the total by the parameter. Use integer division. If the parameter is zero, set the total to zero. Do not print an error message or raise an exception. Make the changes to the Calculator class as needed so that the getHistory method will return a history of all actions as a String The history should start from the initial 0 value to the last input Use the normal operators for the operations (+,-, *, /) There is no limit on the size of the String returned vi. vii. ix. viii. x. The return String should separate all operations and values with a space. Foir example: myCalculator.add (4); myCalculator subtract (2); myCalculatormultiply (2); alculator.add(5) then the history method should return 0+4-2 *2+ 5 Add other variables if needed to the class. Any additional variables must be private. Make changes to the other methods if needed Update all documentations as needed xi. xii. package cse36bassign3, public class Calculator { private int total; public Calculator)f total 0; // not needed - included for clarity public int getTotal ) f return ; public void add (int value) f public void subtract (int value) public void multiply (int value) public void divide (int value) { public String getHistory() f returnStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started