Question: Hi there i am stuck on this question it would be great if i can get some help on it The question is number 1
Flash Cards Objects & ADTS, Part 1 6.9 Name: 1. These three classes simulate a series of addition questions on a stack of flash 3 cards 4. Fill in the MathQuestion - the class to hold each flash card. Adapt the Stack class to hold a Stack of MathQuestions. Fill in the Runner class to add three questions to the stack public class MathQuestion public class Stack private int n; private int na private int count; public MathQuestion private object data) - new Object (50); ni (int) (Math.random()*5); n2 - (int) (Math.random()*5); public Stack (3) 2 count - public MathQuestion(int range) ni - (int) (Math.random()*range); n2 - (int) (Math.random(range); public void push (object addre) data [count] - adde; public String getQuestion V/returns question in format 3.4 = ? count: ) public int size () { return count: > public boolean isFull ) { return (count -- 50); ) ) public int getAnswer return (ni+n2); 3 public void new Question ni = (int) (Math.random()*5); n2 - (int) (Math.random()*5); ) public void newQuestion(int range) { public object pop() count- return data [count); > public Object peek ( return data [count] } 1 public boolean checkAnswer (int guess) V/return true if guess equals the answer //false otherwise public boolean IsEmpty () { return count = 0; 1 public void clear ( count = 0; > Stack 5 new Stack(); MathQuestion q = new MathQuestion(); s.push(9): V/Add two more questions
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
