Answered step by step
Verified Expert Solution
Link Copied!

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

image text in transcribed

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

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

Oracle PL/SQL Programming Database Management Systems

Authors: Steven Feuerstein

1st Edition

978-1565921429

More Books

Students also viewed these Databases questions