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

  Feature of object-oriented programming

Use the Internet or Strayer databases to research the advantages, features, and common examples of OOP and EDP. Describe at least one (1) feature of object-oriented programming that Visual Logic lacks

  Identify the 5 code elements

Identify the 5 code elements for a Password class. Things like: class, instance, and final variables, accessor and mutator method, public and private specifiers for methods and member variables.i need to provide detail and descriptions for each code ..

  Develop a java based gui application

Develop a Java based GUI application(using swing) that allows the user to enter Charity/Fund information and display them in a JTable

  Write a jsf application that reports the values

Write a JSF application that reports the values of the following system properties of the web server

  The 7th test of credits

The 7th test of credits? this is the 7th test of credits? this is the 7th test of credits? this is the 7th test of credits?this is the 7th test of credits?this is the 7th test of credits?this is the 7th test of credits?this is the 7th test of credits..

  Implements the queue interface

Element from an ArrayList is slow because of all the shifting. For this question, you should modify the poll()method so that it runs in constant time - implementations as well as correct/fast implementations. In the former case, your functions may..

  Create a private field to represent each of these states

Create three public classes: one named App, one named Pet and one named PetOwner. The App class has a static void main method that performs all the actions for the Deliverable A and Deliverable B requirements.

  Become the leading coffee shop in arlington and to be the

primarily my project involves theestablishing of a javanet cafeacute where customers would enjoy coffee as they connect

  Write a program which randomly chooses an integer

Write a program which randomly chooses an integer from 1 to 100. The program should then tell the user.The program should then ask the user to complete the puzzle such that each row and each column consists of the letters

  Create an application for kochs cottages

Create an application for Koch's Cottages, a weekend getaway resort that rents boats and cottages to use on the local lake.

  Displays the calendar for the current month

Prepare a program that displays the calendar for the current month. You will use the Prior and next buttons to show the calendar of the previous or next month.

  Calculate the vertical and horizontal components of u

Calculate the vertical and horizontal components of u (the launch velocity) using the following trigonometric identities:

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