
Java
BooleanCompareNode.java
public class BooleanCompareNode extends Node {
enum CompareType {
eq, ne, lt, gt, le, ge
};
CompareType type;
Node left;
Node right;
public BooleanCompareNode(CompareType type, Node left, Node right) {
this.type = type;
this.left = left;
this.right = right;
}
public String ToString() {
return left.toString() + type.toString() + right.toString();
}
}
VariableReferenceNode.java
public class VariableReferenceNode extends Node{
String name;
Node arrayIndex;
public VariableReferenceNode(String name) {
this.name = name;
this.arrayIndex = arrayIndex;
}
public String ToString() {
String indexString = (arrayIndex == null) ? "" : "[" + arrayIndex.toString() + "]";
return name + indexString;
}
public void setIndex(Node indexExpr) {
}
public String getVariableName() {
return null;
}
}
IfNode.java
import java.util.ArrayList;
import java.util.List;
public class IfNode<BooleanCompare> extends Node{
private BooleanCompare condition;
private ArrayList<StatementNode> statements;
private IfNode nextIf;
public IfNode(BooleanCompare condition, ArrayList<StatementNode> statements, IfNode nextIf) {
this.condition = condition;
this.statements = statements;
this.nextIf = nextIf;
}
public BooleanCompare getCondition() {
return condition;
}
public ArrayList<StatementNode> getStatements() {
return statements;
}
public IfNode getNextIf() {
return nextIf;
}
@Override
public String ToString() {
StringBuilder sb = new StringBuilder("IfNode: { Condition: ");
sb.append(condition.toString()).append(", Statements: [");
for (StatementNode statement : statements) {
sb.append(statement.toString()).append(", ");
}
sb.delete(sb.length() - 2, sb.length());
sb.append("]");
if (nextIf != null) {
sb.append(", NextIf: ").append(nextIf.toString());
}
sb.append("}");
return sb.toString();
}
}
RepeatNode.java
import java.util.ArrayList;
public class RepeatNode<BooleanCompare> extends Node {
private BooleanCompare condition;
private ArrayList<StatementNode> statements;
public RepeatNode(BooleanCompare condition, ArrayList<StatementNode> statements) {
this.condition = condition;
this.statements = statements;
}
BooleanCompare getCondition() {
return condition;
}
public ArrayList<StatementNode> getStatements() {
return statements;
}
@Override
public String ToString() {
StringBuilder sb = new StringBuilder("RepeatNode: { Condition: ");
sb.append(condition.toString()).append(", Statements: [");
for (StatementNode statement : statements) {
sb.append(statement.toString()).append(", ");
}
sb.delete(sb.length() - 2, sb.length());
sb.append("]}");
return sb.toString();
}
}
WhileNode.java
import java.util.ArrayList;
public class WhileNode<BooleanCompare> extends Node {
private BooleanCompare condition;
private ArrayList<StatementNode> statements;
public WhileNode(BooleanCompare condition, ArrayList<StatementNode> statements) {
this.condition = condition;
this.statements = statements;
}
public BooleanCompare getCondition() {
return condition;
}
public ArrayList<StatementNode> getStatements() {
return statements;
}
@Override
public String ToString() {
StringBuilder sb = new StringBuilder("WhileNode: { Condition: ");
sb.append(condition.toString()).append(", Statements: [");
for (StatementNode statement : statements) {
sb.append(statement.toString()).append(", ");
}
sb.delete(sb.length() - 2, sb.length());
sb.append("]}");
return sb.toString();
}
}


Trending nowThis is a popular solution!
Step by stepSolved in 4 steps

Where are the methods being used that I circled in the rubric? I don't see anything. I added all the needed java files for the methods to be added for each java file shown above. Which is why I circled the methods. Please fix this and show me the methods being used that I circled for the java files.
Where are the methods being used that I circled in the rubric? I don't see anything. I added all the needed java files for the methods to be added for each java file shown above. Which is why I circled the methods. Please fix this and show me the methods being used that I circled for the java files.
- Code for Activity2PayStub: // Activity2PayStub.java import java.util.Scanner; public class Activity2PayStub{ // constants public static final double OVERTIME_RATE = 1.5; public static final double SS_WITHHOLDING = .1; public static final double FEDERAL_TAX = .2; // fields private String name, ssn; private int regHours, overHours; private double hourlyRate, regPay, overRate, overPay, grossPay, ssWith, fedTax, netPay; public static void main(String[] args) { Scanner keyboard = new Scanner(System.in); // create an object of Activity2PayStub class Activity2PayStub a2ps = new Activity2PayStub(); // get inputs a2ps.getInput(keyboard); // compute payments a2ps.calculate(); // display information a2ps.printPayStub(); } /** * method that takes inputs of name, ssn, regular hours, overtime hours * and hourly rate and set the fields to the values input by the user */ public void getInput(Scanner keyboard) {…arrow_forwardPlease fill in all the code gaps if possible: (java) public class LinkedListNode { private Object date; private LinkedListNode next; // Constructor: public LinkedListNode (Object data) // You also need to define the getter and setter: public LinkedListNode getNext() public void setNext (LinkedListNode next) public Object getData() public void setData(Object data) }arrow_forwardZOOM + Press Esc to exit full screen Create a new java project named CH46EX 1. Create a class named Student 1. 2 private instance data fields – student name, student id 2. 1 final and static constant for a COLLEGE, set to "Fullerton" Create one programmer written constructor that accepts parameters for two instance data fields during instantiation Create a static method named demoStaticMethod ()-see output 3. | - print message, print college 4. Create a non-static method named demoObjectMethod ()– see output - print message, college, student name, student id 2. Create an application named StudentDemo 1. Create/instantiate 1 student object 2. Call each method correctly This demo is a static method Fullerton 3. Expected Output > This demo is a non-static method Fullerton Name: Wyle Coyote ID: 456arrow_forward
- javaarrow_forwardimport bridges.base.ColorGrid;import bridges.base.Color;public class Scene {/* Creates a Scene with a maximum capacity of Marks andwith a background color.maxMarks: the maximum capacity of MarksbackgroundColor: the background color of this Scene*/public Scene(int maxMarks, Color backgroundColor) {}// returns true if the Scene has no room for additional Marksprivate boolean isFull() {return false;}/* Adds a Mark to this Scene. When drawn, the Markwill appear on top of the background and previously added Marksm: the Mark to add*/public void addMark(Mark m) {if (isFull()) throw new IllegalStateException("No room to add more Marks");}/*Helper method: deletes the Mark at an index.If no Marks have been previously deleted, the methoddeletes the ith Mark that was added (0 based).i: the index*/protected void deleteMark(int i) {}/*Deletes all Marks from this Scene thathave a given Colorc: the Color*/public void deleteMarksByColor(Color c) {}/* draws the Marks in this Scene over a background…arrow_forwardImplement move the following way. public int[] walk(int... stepCounts) { // Implement the logic for walking the players returnnewint[0]; } public class WalkingBoardWithPlayers extends WalkingBoard{ privatePlayer[] players; privateintround; publicstaticfinalintSCORE_EACH_STEP=13; publicWalkingBoardWithPlayers(int[][] board, intplayerCount) { super(board); initPlayers(playerCount); } publicWalkingBoardWithPlayers(intsize, intplayerCount) { super(size); initPlayers(playerCount); } privatevoidinitPlayers(intplayerCount) { if(playerCount <2){ thrownewIllegalArgumentException("Player count must be at least 2"); } else { this.players=newPlayer[playerCount]; this.players[0] =newMadlyRotatingBuccaneer(); for (inti=1; i < playerCount; i++) { this.players[i] =newPlayer(); } } } package walking.game.player; import walking.game.util.Direction; public class Player{ privateintscore; protectedDirectiondirection=Direction.UP; publicPlayer() {} publicintgetScore() { return score; }…arrow_forward
- Java Program This assignment requires one project with two classes. Class Employee Class Employee- I will attach the code for this: //Import the required packages. import java.text.DecimalFormat; import java.text.NumberFormat; //Define the employee class. class Employee { //Define the data members. private String id, lastName, firstName; private int salary; //Create the constructor. public Employee(String id, String lastName, String firstName, int salary) { this.id = id; this.lastName = lastName; this.firstName = firstName; this.salary = salary; } //Define the getter methods. public String getId() { return id; } public String getLastName() { return lastName; } public String getFirstName() { return firstName; } public int getSalary() { return salary; } //Define the method to return the employee details. @Override public String toString() { //Use number format and decimal format //to…arrow_forwardWrite the LCSMatrix.java: import java.util.*; // Your code here // - Import any required additional packages // - Declare any desired classes to be used by LCSMatrix public class LCSMatrix { private int rowCount; private int columnCount; // // Your code here // public LCSMatrix(String str1, String str2) { this.rowCount = (int) str1.length(); this.columnCount = (int) str2.length(); // Your code here } // Your code here, if needed // Returns the number of columns in the matrix, which also equals the length // of the second string passed to the constructor. public int getColumnCount() { return columnCount; } // Returns the matrix entry at the specified row and column indices, or 0 if // either index is out of bounds. public int getEntry(int rowIndex, int columnIndex) { // Your code here (remove placeholder line below) return 0; } // Returns the number of rows in the matrix, which also equals the length // of the first string passed to the constructor.…arrow_forwardpublic class OfferedCourse extends Course { // TODO: Declare private fields // TODO: Define mutator methods - // setInstructorName(), setLocation(), setClassTime() // TODO: Define accessor methods - // getInstructorName(), getLocation(), getClassTime() } import java.util.Scanner; public class CourseInformation { public static void main(String[] args) { Scanner scnr = new Scanner(System.in); Course myCourse = new Course(); OfferedCourse myOfferedCourse = new OfferedCourse(); String courseNumber, courseTitle; String oCourseNumber, oCourseTitle, instructorName, location, classTime; courseNumber = scnr.nextLine(); courseTitle = scnr.nextLine(); oCourseNumber = scnr.nextLine(); oCourseTitle = scnr.nextLine(); instructorName = scnr.nextLine(); location = scnr.nextLine(); classTime = scnr.nextLine(); myCourse.setCourseNumber(courseNumber); myCourse.setCourseTitle(courseTitle);…arrow_forward
- Python please. Starter code: from player import Playerdef does_player_1_win(p1_hand, p2_hand):#given both player-hands, does player 1 win? -- return True or Falsedef main():# Create players# Have the players play repeatedly until one wins enough timesmain() #you might need something hereclass Player: # player for Rock, Paper, Scissors# ADD constructor, init PRIVATE attributes# ADD method to get randomly-generated "hand" for player# ADD method to increment number of wins for player# ADD method to reset wins to 0# ADD getters & setters for attributesarrow_forwardJava programarrow_forwardHere is my code in Java: import java.util.Scanner; import java.util.HashMap; public class Inventory { /** This class demonstrates the inventory */ //Declarations Of inventory static final int LightBulb60W = 1; static final int LightBulb100W = 2; static final int BoltM5 = 3; static final int BoltM8 = 4; static final int Hose25 = 5; static final int Hose50 = 6; public static void main (String [] args) { //Scanner Object @SuppressWarnings("resource") Scanner keyboard = new Scanner(System.in); //Variables int month; int day; int year; double units; double cost = 0; //Declarations int total; HashMap<Integer, String> productMap = new HashMap<>(); productMap.put(1,"Light Bulb 60W"); productMap.put(2,"Light Bulb 100W"); productMap.put(3,"Bolt M5"); productMap.put(4,"Bolt M8"); productMap.put(5,"Hose 25 feet"); productMap.put(6,"Hose 50 feet 60W"); while(true){ //Prints out inventory System.out.println("The Inventory: "); System.out.println("1…arrow_forward
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education





