Create the visit method and whatever other methods you see

Assignment Help JAVA Programming
Reference no: EM131415154

You have been provided with a framework for a java application. It will not compile because there is a class and method missing (Visitor::visit). Your assignment is to create the visit method and whatever other methods you see fit. There are some rather unusual rules, though:

1) You may not use loops (while, for, do/until). Any looping that needs to happen must happen via recursion.

2) You may create ONLY local variables. You may NOT create members or globals.

3) You may NOT submit changes to any of the classes in the framework. You MAY and SHOULD, however, add your own tests to "Main" and test your code thoroughly.

4) Visitor must be a static class with only static methods. All methods except Visit must be private.

Visitor will be passed a "StatementsNode". Visitor must print assembly instructions in the following format:

##: opc op1,op2

For example:

0: add R0,R1

or

1: sub $1000,$2000

or

3: jmp $9999

The first value is a sequence number and is incremented after an instruction is printed.

There are two types of operand:

RegisterOperand - this represents a register in the CPU. It contains a single int. Print these as R# (R0, R1, R2, etc)

AddressOperand - this represents an address in the computer's memory. It contains a single long. Print these as $# ($1234, $3456), etc. Don't worry about forcing a certain number of decimal places.

Do not assume that if an instruction uses one type of operand, all of the operands will be of the same type. It is perfectly acceptable to have this:

add R0,$2000

There are three types of instruction node:

StatementsNode - this node contains a list of Nodes. Print each node in the list. The list will never be null or empty.

TwoOperandNode - this node represents math - add, sub, mul, div. Each node has two operands and a "type" character (one of +, -, *, /).

WhileOperand - this node represents a while loop. It contains two StatementsNodes - statements and conditions. Here is the format for a WhileOperand:

$X: <<<conditions>>>

                bne $00000000

                <<<statements>>>

                jmp $X

X has to match the counter of the first instruction in the conditions. Neither statements nor conditions can be null or empty.

Attachment:- JAVA Assignment.zip

Reference no: EM131415154

Questions Cloud

Consultant demonstrated how our aggregate remuneration : The consultant demonstrated how our aggregate remuneration might be ameliorated by modifications in our propensities to utilize credit for compensating for services. She also endeavored to ascertain which of our characteristics were analogous to thos..
How can a firm take maximum advantage of mobile technology : How can a firm take maximum advantage of mobile technology, more specifically, mobile apps, and what it has to offer?
Human resource mgmt assignment : There are several standardized training events in large organizations that are required annually or biannually. One of these is often sexual harassment. For this assignment, write a training plan for all employees in your firm to educate and devel..
After watching the videos write an analysis : After watching the videos, write an analysis. The paper should be an account of the key issues or problems in the video, followed by a critique of the videos.
Create the visit method and whatever other methods you see : You have been provided with a framework for a java application. It will not compile because there is a class and method missing (Visitor::visit). Your assignment is to create the visit method and whatever other methods you see fit. There are some ..
Identify two event planning software available : Identify 2 Event Planning Software available. Evaluate their website and identify the strengths and weaknesses of each of the software you selected. Look at the software in relationship to the 5 phase event planning process. Identify the areas that w..
Why is hbse relevant to social work : The types of issues and concerns that children, and adolescents, present to social workers are as varied as the people themselves. Understanding how individuals behave in their particular environment will shed some light on their current challenge..
Employee training and development : Text book is Employee Training and Development sixth edition by Raymond A. Noe The name of the class is BHR 4680, Training and Development, Columbia Southern University Chapter 4 Learning and Transfer of Training. Describe the learning condition you ..
What is meant by a consumer-driven long-term care system : What is meant by a "consumer-driven" long-term care system? What are some of the rights and responsibilities of long-term care consumers? What are the components of accessibility to long-term care services?

Reviews

Write a Review

JAVA Programming Questions & Answers

  Recursive factorial program

Write a class Array that encapsulates an array and provides bounds-checked access. Create a recursive factorial program that prompts the user for an integer N and writes out a series of equations representing the calculation of N!.

  Hunt the wumpus game

Reprot on Hunt the Wumpus Game has Source Code listing, screen captures and UML design here and also, may include Javadoc source here.

  Create a gui interface

Create GUI Interface in java programing with these function: Sort by last name and print all employees info, Sort by job title and print all employees info, Sort by weekly salary and print all employees info, search by job title and print that emp..

  Plot pois on a graph

Write a JAVA program that would get the locations of all the POIs from the file and plot them on a map.

  Write a university grading system in java

University grading system maintains number of tables to store, retrieve and manipulate student marks. Write a JAVA program that would simulate a number of cars.

  Wolves and sheep: design a game

This project is designed a game in java. you choose whether you'd like to write a wolf or a sheep agent. Then, you are assigned to either a "sheep" or a "wolf" team.

  Build a graphical user interface for displaying the image

Build a graphical user interface for displaying the image groups (= cluster) in JMJRST. Design and implement using a Swing interface.

  Determine the day of the week for new year''s day

This assignment contains a java project. Project evaluates the day of the week for New Year's Day.

  Write a java windowed application

Write a Java windowed application to do online quiz on general knowledge and the application also displays the quiz result.

  Input pairs of natural numbers

Java program to input pairs of natural numbers.

  Create classes implement java interface

Interface that contains a generic type. Create two classes that implement this interface.

  Java class, array, link list , generic class

These 14 questions covers java class, Array, link list , generic class.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd