Answered step by step
Verified Expert Solution
Question
1 Approved Answer
create a simple command - line program in Swift programming language that uses the basic math rules. All the numbers are of Int type. You
create a simple commandline program in Swift programming language that uses the basic math rules. All the numbers are of Int type.
You are to prepare a macoS commandline tool that will act as a simple calculator. The
calculator will be run from the command line and will only work with integer numbers and the
following arithmetic operators: The operator is the modulus operator, not
percentage.
For example, if the program is compiled to
the following demonstrates how it will work
In the command line, the arguments are a repeated sequence in the form
number operator
and ending in a
number
Hitting the enter key will cause the program to evaluate the arguments and print the result. In
this case
The program must follow the usual rules of arithmetic which say:
The and operators must all be evaluated before the and operators.
Operators must be evaluated from left to right.
For example, using Rule
becomes
which results in
with the given code main and calculator and if needed others exmaple operatortree
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