Engineering
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'].

answer
Answers: 2

Other questions on the subject: Engineering

image
Engineering, 04.07.2019 18:10, leomessifanboy678
The filament of an incandescent lamp has a temperature of 2000k. calculate the fraction of radiation emitted in the visible light band if the filament is approximated as blackbody
Answers: 2
image
Engineering, 04.07.2019 18:10, aliopqwas
Condition monitoring is a major component of. (clo4) a)- predictive maintenance. b)-preventive maintenance c)-proactive maintenance d)-reactive maintenance.
Answers: 1
image
Engineering, 04.07.2019 18:10, Larkinlover703
Items are similar to the free issue items, but their access is limited. (clo5) a)-bin stock items free issue b)-bin stock controlled issue c)-critical or insurance spares d)-rebuildable spares e)-consumables
Answers: 1
image
Engineering, 04.07.2019 18:20, rocio5649
Amixture of slurry and mud is to be pumped through a horizontal pipe of diameter 500 mm. the fluid behaves as a bingham plastic with a yield stress of 30 pa and viscosity 0.04 pa. s. describe the effects of the shear stress through a transverse section of the pipe by plotting the variation in shear stress and velocity profile: (i) just before the slurry starts to move (ii) as the slurry flows when the pressure gradient is double that in part (i)
Answers: 3
Do you know the correct answer?
Create a java program which implements a simple stack machine. the machine has 6 instructions; push...

Questions in other subjects:

Konu
Arts, 12.12.2020 16:00
Konu
Social Studies, 12.12.2020 16:00