Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

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 .
All the details is provided on the imaje please help me solve the question
image text in transcribed
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

Step: 1

blur-text-image

Get Instant Access with AI-Powered Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions