Question: Project 4 help Im having trouble with a project. My question class is coming off wrong and this interferes with my application class. Im providing

Project 4 help

Im having trouble with a project. My question class is coming off wrong and this interferes with my application class.

Im providing some picture for assistance.

package proj4;/** * 

* Title: Project 4: Parsing the Question class */public class Project4App { public static void main(String[] args) { for (int i = 1; i

package proj4;import java.util.Random;import proj4.Question;/*** Title: Programming Project #4* Description: This class represents mathematical equations that can be used in a math game.* Equations can be either addition or subtraction***/ public class Question { /** * default constructor * Description: to generate random values for the three instance variables */ private int operand1; private int operand2; private char operator; public Question() { //this generates random values for 2 instance variables Random random = new Random(); if (random.nextBoolean()) { operand1 = random.nextInt(13); operand2 = random.nextInt(13); operator = '+'; } else { operand1 = random.nextInt(7) + 6; operand2 = random.nextInt(operand1 + 1); operator = '-'; } } /*** Name: Accessor method of getOperand1 * Description: This Accessor method retrieves the private operand1 variable * inside the question object * @return operand1 */ public int getOperand1() { return operand1; } /*** Name: Accessor method of getOperand2 * Description: This Accessor method retrieves the private operand2 variable * inside the question object * @return operand2 */ public int getOperand2() { return operand2;} /*** Name: Accessor method of getOperator * Description: This Accessor method retrieves the private operator variable * with the question object * @return operator */ public char getOperator() { return operator; } /***Name: toString method *Description: this method combines all the instance variables * with there current values * @return the String expression of the operand1, operator, operand2 */ public String toString() { return operand1 + " " + operator + " " + operand2 + " ="; } /*** Name: determineAnswer method * Description: determineAnswer method calculates the answer to the question * @return result of the expression: operand1 operator operand2 */ public int determineAnswer(){ if (operator == '+') {return operand1 + operand2; } else { return operand1 - operand2; } } }
Project 4 helpIm having trouble with a project. My question class iscoming off wrong and this interferes with my application class.Im providing somepicture for assistance.package proj4;/** * * Title: Project 4: Parsing the Question

CSC 120 Programming Project #4 Important notes: BREAK and CONTINUE statements should not be used in this project. while loops should not be written as if they are for loops. For example: int i = 0; while(i Project4App (1) [Java Application] /System/Lib What is the result? 7 - 1 = Congratulations, you got it correct! Progress Report: Addition: You got 6 correct and 2 incorrect. Subtraction: You got 6 correct and 0 incorrect. The percent correct is 86.0% Page 3 of 7

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 Programming Questions!