Question: In Java: Class ReserveTable This is a lookup table list ADT that will eventually be used for opcode lookups, and needs to be able to

In Java:

Class ReserveTable

This is a lookup table list ADT that will eventually be used for opcode lookups, and needs to be able to be used with the compiler, a separate instance will hold the reserved word list for the language. Make sure it is built so that it can be used for both applications. Each indexed entry is a pair consisting of a name string and an integer code. The table as we use it is static, and intialized once at the start of the program, and then used only for lookups later on. There are no updates. The needed methods are:

ReserveTable(int maxSize)

Constructor, as needed.

int Add(string name, int code)

Returns the index of the row where the data was placed; just adds to end of list, and does not check for duplicates..

int LookupName(String name)

Returns the code associated with name if name is in the table, else returns -1. String LookupCode(int code)

Returns the associated name if code is there, else an empty string

PrintReserveTable(String filename)

Prints to the named file the currently used contents of the Reserve table in neat tabular format, one row per text line.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!