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
The higher the astm grain-size number, the coarser the grain is. a)-true b)-false
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 19:10
Which of the following is the most important advantage of a large field of view? a. allows larger areas to be examined b. relieves eyestrain c. minimizes parallax errors. d. increases precision in proportion to the in- crease in field of view
Answers: 2
question
Engineering, 06.07.2019 03:10
List and describe the attached tools in boxford cnc milling machine? and how many tools were used in your projects explain them?
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
Geography, 23.08.2020 01:01
question
Chemistry, 23.08.2020 01:01
question
Chemistry, 23.08.2020 01:01
Questions on the website: 13722363