Question: Write a class called Calculator that performs simple integer arithmetic on the command line arguments. Your application will take a single integer followed by an

 Write a class called Calculator that performs simple integer arithmetic on

Write a class called Calculator that performs simple integer arithmetic on the command line arguments. Your application will take a single integer followed by an operator (see below), followed by another integer. Your Calculator class must support the following operators: additions (+), subtraction (-), multiplication (x), and division (), exponentiation (^). You may write the logic in the main function. You need not instantiate an instace of the Calculator class to make it run. The invocation and output should be as follows: C:\IS147\test> java -cp . Calculator 6 / 3 Calculator: 6 / 3 = = 2 C:\IS147\test> java -cp. Calculator 6 x 2 Calculator: 6 x 2 = 12 C:\IS147\test> java -cp. Calculator 6 + 4 Calculator: 6 + 4 10 3 C:\IS147\test> java -cp. Calculator 6 Calculator: 6 - 3 = 3 C:\IS147\test> java -cp. Calculator 6 ^ 3 Calculator: 6 ^ 3 = 216

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!