subject
Engineering, 04.12.2019 07:31 juter92

Create a java program which implements a simple stack machine. the machine has 6 instructions; push operand puts a value on the stack. the operand is either a floating point literal or one of 10 memory locations designated m0 – m9 pop operand pops the value on the top of the stack and moves it to the memory location m0-m9 add pops the top two values off the stack, performs the operation, then pushes the result on the sub stack. note that the value that was pushed first comes first in the operation. sub works like this, mul t2 = t1 = t3 = t1 – t2, push(t3). div requirements 1. the program must be written in java. it may implement its own stack, or it may use the java api stack class. only floating point values are stored on the stack and in memory. 2. the instructions are read from the machine. txt file. 3. in addition to moving a value from the stack to memory, the pop operation must display a message on the console. 4. this program does not have to deal with error conditions like stack underflow or invalid input. 5. the program needs work for any valid input file. the instructor will test it with data that is different from this sample data. hints 1. java’s stack class works great for this. google "java stack class" for documentation and examples. 2. you can use the second character as an index into an array which holds your 10 memory locations., like this, memory[str. charat(1) - '0'].

ansver
Answers: 2

Another question on Engineering

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
Carbon dioxide gas expands isotherm a turbine from 1 mpa, 500 k at 200 kpa. assuming the ideal gas model and neglecting the kinetic and potential energies, determine the change in entropy, heat transfer and work for each kilogram of co2.
Answers: 2
question
Engineering, 04.07.2019 18:10
Which of the following ziegler nichols tuning methods the response of the controller to a step input should exhibit an s-shaped curve? a)-open loop mode b)-closed loop mode c)-both modes (open & closed) d)-none of the modes (open & closed)
Answers: 3
question
Engineering, 04.07.2019 18:10
Water at the rate of 1 kg/s is forced through a tube with a 2.5 cm inner diameter. the inlet water temperature is 15°c, and the outlet water temperature is 50°c. the tube wall temperature is 14°c higher than the local water temperature all along the length of the tube. what is the length of the tube?
Answers: 3
You know the right answer?
Create a java program which implements a simple stack machine. the machine has 6 instructions; push...
Questions
question
Mathematics, 06.06.2020 18:57
question
Mathematics, 06.06.2020 18:57
Questions on the website: 13722367