The Java application Run configuration will contain two program arguments to be passed in. These two arguments will be passed in when the program starts - for example, integers like 5 and 10. This application will perform four operations on these two values: addition, subtraction, multiply & division and it will print out the results. The two arguments get passed into the main method as a String array in the variable object named args. Remember they get passed in as Strings so you need to parse them into integers using the Integer.parseInt(args) before you can treat them as integers.
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 Main 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 arguments and will return an integer result value.
Remember to call static methods just use the className.methodName() for example Calculate.addition(). To call non-static methods, you will need to first instantiate an object of that class then call the method using the object objectName.methodName() for example calc.addition() using the calc object you created first from the Calculate class.
Modify the main method in Lab7 to make calls to all four of the Calculate class methods addition(), subtraction(), multiply() and division() and print out the results to the terminal. Remember how you call static and non-static methods are different. There should be only two classes in this IntelliJ solution Calculate and Main as shown below. To create a new Class just right click on your package (edu.psu.ist242) select New -> Java Class -> Calculate.
The output should look like this
Thank you and I always have a problem with this class as far as the book but have gotten that straight and I do appreciate what you do. Thank you
You guys have provided me the best Technical Writing service. And that is in such a short time. Thank you so much.
Everything was amazing. I loved it because references used Perfect. I will continue working with you. Thanks