Question: This program is basically a calculator that uses stacks in modular 3 with the following specifications IN C++ OR JAVA: I have the program to

This program is basically a calculator that uses stacks in modular 3 with the following specifications

IN C++ OR JAVA:

This program is basically a calculator that uses stacks in modular 3

I have the program to test the algorithm with 100, 1000 and 10000 so you just need to make the program in c++ or java that is basically a calculator that uses stacks in modular 3 and test the following:

with the following specifications IN C++ OR JAVA: I have the program

Write a non-recursive program using a stack that evaluates arithmetic expressions over the set Z3 10, 1, 2). Assume that the expressions consist of operands from Z3 only, parentheses, and three operations,?3, 3 and 3, which represent the common arithmetic operations +,-, * modular 3, in that order. For examples, 2 3 1 (2 + 1) mod 3-0 and 1 ?3 2 2-(1-2 * 2) mod 3-0. Note that like regular arithmetic operations + and-, the first operands of operations 3 and 3 can be omitted if they are O's appearing as the first tokens of an expression or right after a "(". For examples, 3 2 (-2) mod 3-1 2 3 (O3 1) (2+(-1)) mod 3 1, and 31 +1 mod 3-1. Analyze the running time of your algorithm in terms of the input size n, which in this case is the number of symbols in the logical expression given as the input. Run your program on 3 randomly generated arithmetic expression over containing at least 100, 1000 and 10000 symbols to verify your running time analysis result. Z3. Feel free to use common symbols +,-and * to represent?3, ?3 and ?3 in that order, for the easiness of programming. You should also assume the following operator precedence: (), 3, 3, and 3, where 3, and 3 are considered having the same priorities Note: We now allow 3 and 3 to be "unary" serving as the sign symbol if they are the first operations of an expression or immediately after a (. So you need to think about what modifications need to be made on the stack-based algorithm for evaluating expressions in order to correctly handle expressions containing unary 3 and 3. You may use the following attached programs to randomly generate arithmetic expressions over Za and test cases to verify the correctness of your program Program for generating random arithmetic expressions over Z3 Write a non-recursive program using a stack that evaluates arithmetic expressions over the set Z3 10, 1, 2). Assume that the expressions consist of operands from Z3 only, parentheses, and three operations,?3, 3 and 3, which represent the common arithmetic operations +,-, * modular 3, in that order. For examples, 2 3 1 (2 + 1) mod 3-0 and 1 ?3 2 2-(1-2 * 2) mod 3-0. Note that like regular arithmetic operations + and-, the first operands of operations 3 and 3 can be omitted if they are O's appearing as the first tokens of an expression or right after a "(". For examples, 3 2 (-2) mod 3-1 2 3 (O3 1) (2+(-1)) mod 3 1, and 31 +1 mod 3-1. Analyze the running time of your algorithm in terms of the input size n, which in this case is the number of symbols in the logical expression given as the input. Run your program on 3 randomly generated arithmetic expression over containing at least 100, 1000 and 10000 symbols to verify your running time analysis result. Z3. Feel free to use common symbols +,-and * to represent?3, ?3 and ?3 in that order, for the easiness of programming. You should also assume the following operator precedence: (), 3, 3, and 3, where 3, and 3 are considered having the same priorities Note: We now allow 3 and 3 to be "unary" serving as the sign symbol if they are the first operations of an expression or immediately after a (. So you need to think about what modifications need to be made on the stack-based algorithm for evaluating expressions in order to correctly handle expressions containing unary 3 and 3. You may use the following attached programs to randomly generate arithmetic expressions over Za and test cases to verify the correctness of your program Program for generating random arithmetic expressions over Z3

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!