subject
Engineering, 14.02.2020 23:30 teionamwhite2262

In your Lab assignment, you should have parsed the input expression from the keyboard, echoed it to the screen and called a subroutine with the input. In this MP you will write code to use a stack to
evaluate the expression. If the read value is an operand, push it onto the stack. If the read value is an operator, pop two values from the stack, apply the operator on the two values and push the result
back on the stack. Keep repeating this for every value read from keyboard and stop when you reach the ASCII value of the "=" (equal sign) character. If the last value is an operand, that means
the expression was invalid. If there is a stack underflow during any point in this process, then the expression was invalid. Do not worry about stack overflows. Look at the flowchart below for a detailed
description of the algorithm.
MP2 is due on Thursday, Sept. 21, by 10pm in your svn repository.
MP2_testcases. docx

For example if the input the user entered on the keyboard was "3 4 -=", then the stack through the evaluation of the expression will be-
Start Read "3"(push x0003) Read "4"(push x0004) Read "-"(pop, calculate and push)
x0000 x0000 x0000 x0000
x0000 x0000 x0004 x0000
x0000 x0003 x0003 x
Examples:
Input Solution in decimal (stored in R5 as binary) Hexadecimal Output on screen
4 5 + 3 * 7 -= 20 (0000000000010100) x0014
5 2 8 * + 3 -= 18 (0000000000010010) x0012
5 1 2 + 4 * + 3 -= 14 (0000000000001110) x000E

ansver
Answers: 2

Another question on Engineering

question
Engineering, 03.07.2019 14:10
Amass of m 1.5 kg of steam is contained in a closed rigid container. initially the pressure and temperature of the steam are: p 1.5 mpa and t 240°c (superheated state), respectively. then the temperature drops to t2= 100°c as the result of heat transfer to the surroundings. determine: a) quality of the steam at the end of the process, b) heat transfer with the surroundings. for: p1.5 mpa and t 240°c: enthalpy of superheated vapour is 2900 kj/kg, specific volume of superheated vapour is 0. 1483 m/kg, while for t 100°c: enthalpy of saturated liquid water is 419kj/kg, specific volume of saturated liquid water is 0.001043m/kg, enthalpy of saturated vapour is 2676 kj/kg, specific volume of saturated vapour is 1.672 m/kg and pressure is 0.1 mpa.
Answers: 3
question
Engineering, 03.07.2019 14:10
The y form of iron is known as: a) ferrite b) cementite c) perlite d) austenite
Answers: 3
question
Engineering, 04.07.2019 18:10
An air conditioning system consist of a 5 cm diameter pipe, operating at a pressure of 200 kpa. the air initially enters the pipe at 15°c with a velocity of 20 m/s and relative humidity of 80%. if the heat supply throughout the process is 960 w, determine the relative humidity and the temperature at the outlet
Answers: 3
question
Engineering, 04.07.2019 18:10
Afour cylinder four-stroke in-line engine has a stroke of 160mm, connecting rod length of 150mm, a reciprocating mass of 3kg and its firing order is 1-3-4-2. the spacing between cylinders is 100mm. i. show that the engine is in balance with regard to the primary inertia forces and primary 3. a and secondary inertia couples. li determine the out of balance secondary inertia force ii. propose ways of balancing this out of balance force and discuss the challenges that will arise
Answers: 3
You know the right answer?
In your Lab assignment, you should have parsed the input expression from the keyboard, echoed it to...
Questions
question
English, 16.02.2021 22:30
question
Mathematics, 16.02.2021 22:30
question
Mathematics, 16.02.2021 22:30
question
History, 16.02.2021 22:30
Questions on the website: 13722359