Question
How to transform the following code to Java and perform the operation. ALGORITItM 93 GENERAL ORDER ARITHMETIC MILLARD H. PERSTEIN Control Data Corp., Palo Alto,
How to transform the following code to Java and perform the operation.
ALGORITItM 93 GENERAL ORDER ARITHMETIC MILLARD H. PERSTEIN Control Data Corp., Palo Alto, Calif. procedure arithmetic (a, b, c, op); integer a, b, c, op; onlment This procedure will perform different order arithmetic operations with b and c, putting the result in a. The order of the operation is given by op. For op = 1 addition is performed. For op = 2 multiplicaLion, repeated addition, is done. Beyond these the operations are non-commutative. For op = 3 exponentiation, repeated multiplication, is done, raising b to the power c. Beyond these the question of grouping is important. The innermost implied parentheses are at the right. The hyper-exponent is always c. For op = 4 tetration, repeated exponentiation, is done. For op = 5, 6, 7, etc., the procedure performs pentation, hexation, heptation, etc., respectively. The routine was originally programmed in FORTRAN for the Control Data 160 desk-size computer. The original program was limited to tetration because subroutine recursiveness in Control Data 160 FORTRAN has been held down to four levels in the interests of economy. The input parameter, b, c, and op, must be positive integers, not zero;
begin own integer d, e, f, drop;
if op = 1 then
begin a := h-4- c;
go to l
end if op = 2 then d : = 0;
else d : = 1; e := c;
drop := op - 1;
for f := I step 1 until e do
begin arithmetic (a, b, d, drop); d :=a end ; 1 :
end arithmetic
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