Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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 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
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