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, 03.07.2019 15:10
If you were designing a bumper for a car, would you prefer it to exhibit elastic or plastic deformation? why? consider the functions of a bumper in both a minor "fender-bender" and a major collision.
Answers: 1
question
Engineering, 04.07.2019 18:20
Athin walled concentric tube exchanger is used to cool engine oil from 160°c to 60°c with water that is available at 25°c acting as a coolant. the oil and water flow rates are each at 2 kg/s, and the diameter of the inner tube is 0.5 m and the corresponding value of the overall heat transfer coefficient is 250 w/m2. oc. how long must the heat exchanger be to accomplish the desired cooling? cpwater=4.187 kj/kg-candcpengine el=2.035 kj/kg·°c, oil . 120]
Answers: 1
question
Engineering, 04.07.2019 18:20
Agas mixture consists of 8 kmol of h2 and 2 kmol of n2. determine the mass of each gas and the apparent gas constant of the mixture.
Answers: 3
question
Engineering, 04.07.2019 18:20
Avolume of 2.65 m3 of air in a rigid, insulated container fitted with a paddle wheel is initially at 264 k, 5.6 bar. the air receives 432 kj by work from the paddle wheel. assuming the ideal gas model with cv = 0.71 kj/kg • k, determine for the air the amount of entropy produced, in kj/k
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
Mathematics, 16.09.2020 06:01
question
Mathematics, 16.09.2020 06:01
question
Mathematics, 16.09.2020 06:01
question
Mathematics, 16.09.2020 06:01
question
Mathematics, 16.09.2020 06:01
question
Mathematics, 16.09.2020 06:01
question
English, 16.09.2020 06:01
question
Mathematics, 16.09.2020 06:01
question
Mathematics, 16.09.2020 06:01
question
Mathematics, 16.09.2020 06:01
question
English, 16.09.2020 06:01
question
Mathematics, 16.09.2020 06:01
question
Mathematics, 16.09.2020 06:01
question
Mathematics, 16.09.2020 06:01
question
Mathematics, 16.09.2020 06:01
question
Mathematics, 16.09.2020 06:01
question
Mathematics, 16.09.2020 06:01
question
Physics, 16.09.2020 06:01
question
Mathematics, 16.09.2020 06:01
question
Mathematics, 16.09.2020 06:01
Questions on the website: 13722363