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 03:10
What precautions should you take to prevent injuries when dealing with heavy loads?
Answers: 1
question
Engineering, 04.07.2019 18:10
Abrake has a normal braking torque of 2.8 kip in and heat-dissipating cast-iron surfaces whose mass is 40 lbm. suppose a load is brought to rest in 8.0 s from an initial angular speed of 1600 rev/min using the normal braking torque; estimate the temperature rise of the heat dissipating surfaces.
Answers: 3
question
Engineering, 04.07.2019 18:10
Air is to be cooled in the evaporator section of a refrigerator by passing it over a bank of 0.8-cm-outer-diameter and 0.4-m-long tubes inside which the refrigerant is evaporating at -20°c. air approaches the tube bank in the normal direction at 0°c and 1 atm with a mean velocity of 4 m/s. the tubes are arranged in-line with longitudinal and transverse pitches of sl- st 1.5 cm. there are 30 rows in the flow direction with 15 tubes in each row. determine (a) the refrigeration capacity of this system and (b) pressure drop across the tube bank. evaluate the air properties at an assumed mean temperature of -5°c and 1 atm. is this a good assumption?
Answers: 1
question
Engineering, 04.07.2019 18:10
Which from the following instrument is commonly used to detect the high pitch butzing sound in bearings? [clo4] a)-digital ultrasonic meter b)-infrared camera c)-spectroscopic d)-vibrometer
Answers: 2
You know the right answer?
Create a java program which implements a simple stack machine. the machine has 6 instructions; push...
Questions
question
Physics, 22.04.2020 03:22
question
Mathematics, 22.04.2020 03:22
question
Mathematics, 22.04.2020 03:22
question
Mathematics, 22.04.2020 03:22
Questions on the website: 13722363