Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Java Code: I am using the code below but it will not compile. PROGRAM: using System; //import java.util.Scanner; //Create the class that would perform the

Java Code: I am using the code below but it will not compile.

PROGRAM:

using System; //import java.util.Scanner; //Create the class that would perform the simulation. public class Simulator { public static void main(String[] args) { //list of SML instructions const int READ_INS = 10; const int WRITE_INS = 11; const int LOAD_INS = 20; const int STORE_INS = 21; const int ADD_INS = 30; const int SUBTRACT_INS = 31; const int MULTIPLY_INS = 32; const int DIVIDE_INS = 33; const int BRANCH_INS = 40; const int BRANCH_NEG_INS = 41; const int BRANCH_ZERO_INS = 42; const int HALT_INS = 43; //variabes for storing the instruction and its details. int accumulator; int instructionCounter; int op_oprnd; int op_Code; int instructionRegister; //simpletron memArray int[] memArray; //number of instructions entered in memArray int index = 0;

/* Method to run the simpletron simulator*/ }

ERROR MESSAGE:

Simulator.java:1: error: class, interface, or enum expected using System; ^ Simulator.java:9: error: illegal start of expression const int READ_INS = 10; ^ Simulator.java:10: error: illegal start of expression const int WRITE_INS = 11; ^ Simulator.java:11: error: illegal start of expression const int LOAD_INS = 20; ^ Simulator.java:12: error: illegal start of expression const int STORE_INS = 21; ^ Simulator.java:13: error: illegal start of expression const int ADD_INS = 30; ^ Simulator.java:14: error: illegal start of expression const int SUBTRACT_INS = 31; ^ Simulator.java:15: error: illegal start of expression const int MULTIPLY_INS = 32; ^ Simulator.java:16: error: illegal start of expression const int DIVIDE_INS = 33; ^ Simulator.java:17: error: illegal start of expression const int BRANCH_INS = 40; ^ Simulator.java:18: error: illegal start of expression const int BRANCH_NEG_INS = 41; ^ Simulator.java:19: error: illegal start of expression const int BRANCH_ZERO_INS = 42; ^ Simulator.java:20: error: illegal start of expression const int HALT_INS = 43; ^

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Oracle 11G SQL

Authors: Joan Casteel

2nd Edition

1133947360, 978-1133947363

More Books

Students also viewed these Databases questions

Question

Identify the job expectancy rights of employees.

Answered: 1 week ago

Question

What is operatiing system?

Answered: 1 week ago