Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

(JAVA) Using the IST Linux system create the following Java command line calculator application Lab7Oakes.java replace Oakes with your last name. Make sure to include

(JAVA)

Using the IST Linux system create the following Java command line calculator application Lab7Oakes.java replace Oakes with your last name. Make sure to include the standard project header comments.

Pass in two arguments from the Linux command line when the program starts. For example java Lab7Oakes value1 value2. Replace value1 and value2 with integers like 200 100 - java Lab7 200 100 This will perform four operations on these values: addition, subtraction, multiply & division and print out the results - see the attached example. 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[0]) 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 Lab7 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 Lab7 to make calls to all the four 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. Please include the Java source code printout along with the program running in your pdf upload.

Your application will have two source files Calculate.java and Lab7Oakes.java - compile both of them using javac.

To run it use java Lab7 200 100

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Design Application And Administration

Authors: Michael Mannino, Michael V. Mannino

2nd Edition

0072880678, 9780072880670

More Books

Students also viewed these Databases questions