EquationGenerator - EquationGenerator.java Authors Lewis...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
//******************************************************************** // EquationGenerator.java Authors: Lewis and Loftus // // Solution to Programming Project 9.10 // // Generates random addition, subtraction, multiplication and division // equations. //******************************************************************** import java.util.Random; public class EquationGenerator { final int MAX_NUMBER = 11; // use numbers between 0 and 10 Random numberGenerator; public EquationGenerator() { numberGenerator = new Random(); } //----------------------------------------------------------------- // Returns a random addition equation //----------------------------------------------------------------- public Equation generateAdditionEquation() { Equation eq = new Equation(); eq.setFirstNumber(numberGenerator.nextInt(MAX_NUMBER)); eq.setSecondNumber(numberGenerator.nextInt(MAX_NUMBER)); eq.setEquationType(Equation.ADDITION); return eq; } //-----------------------------------------------------------------
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 05/17/2011 for the course COP 3530 taught by Professor Davis during the Spring '08 term at University of Florida.

Page1 / 2

EquationGenerator - EquationGenerator.java Authors Lewis...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online