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

  Describe the basic c syntax for creating a class comprise

explain the basic c syntax for creating a class. include an explanation of the private and public section of a class

  Program obtaining the new scriptdownload and save the

program obtaining the new scriptdownload and save the attached comment cgi mailer script form-mail2.pl to your servers

  Write a java application that reads a file containing text

Write a Java application that reads a file containing text. Your program should read each line and display it on the console screen preceded by line numbers. If the input file is:

  Create the physical process model

You were hired as an analyst to develop a new information system to automate the payroll transactions in a mid-size organization. The proposed system will contain employees' data and interface with the organization's General Ledger system (GL).

  Translates a number into the closest letter grade

Write a program that translates a number into the closest letter grade. For case, the number 2.8 which might have been the average of several grades would be converted to B-

  Write a program to play a game of craps

Write a program to play a game of "craps," a dice game popular in casinos. Here are the rules - Use functions appropriately. The program should allow the user to play another round.

  Implement a probability calculator for the standard normal

implement a probability calculator for the standard normal distribution using GUI.

  Write a java application that calculates and displays

The application should ask the user to enter the name of the property owner and the assessed value of the property for each owner (total N owners) and calculate the property tax.

  Create java class that represents your musical instrument

Create your own Java class that represents your favorite musical instrument. Your musical instrument class should have at least 3 constants, 5 private data fields, getters and setters for each private data field.

  Write java applet for costco gas station

Write a java applet for costco gas station. The applet will first ask you whether you are a costco customer, then the grade of gas you want to use: grade 87, 89, or 91.

  Develop an application for lapland uas

Description of the project Your duty is to plan and develop an application for Lapland UAS - Database plan and description

  File integrity checker - tripwire

Write a program that will perform some of the basic tasks accomplished by a file integrity checker such as Tripwire.

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