Question: Java Calculator: Create a new file Java class called Calculate.java. This class Calculate will contain two static public methods addition() and subtraction() which you call
Java Calculator:
Create a new file Java class called Calculate.java. This class Calculate will contain two static public methods addition() and subtraction() which you call in the Lab2 class using the Calculate class name. The Calculate class will also contain two non-static public methods multiply() and division() which you call using the Calculate object that you create. All these methods will accept two integers as input variables and will return an integer result value. Compile it with javac Calculate.java Modify the main method in Lab2 to make calls to all the four Calculate class methods addition(), subtraction(), multiply() and division() and print out the results to the terminal.
Pass in two arguments from the Linux command line when the program starts. These arguments will be 400 and 200. The two arguments get passed into the main method as a String array in the variable object named arg. Parse them into integers using the Integer.parseInt(args[0]) before you can treat them as integers.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
