Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.help > #2679
| From | "John B. Matthews" <nospam@nospam.invalid> |
|---|---|
| Newsgroups | comp.lang.java.help |
| Subject | Re: Need to create a default constructor that generates 2 random questions. I'm fairly new to programming |
| Date | 2013-04-14 13:30 -0400 |
| Organization | The Wasteland |
| Message-ID | <nospam-559D38.13302014042013@news.aioe.org> (permalink) |
| References | <063e6687-49a9-49d6-b7d4-29fd86115329@googlegroups.com> <qc3lm85qcq7usmh1ph9an44j2mskps43o1@4ax.com> |
In article <qc3lm85qcq7usmh1ph9an44j2mskps43o1@4ax.com>, Roedy Green <see_website@mindprod.com.invalid> wrote: > On Fri, 12 Apr 2013 16:11:33 -0700 (PDT), sunnyaleem@gmail.com wrote, > quoted or indirectly quoted someone who said : > > > Need to create a default constructor that generates a random > > question, addition or subtraction. And when adding the numbers > > must be random from 0-12 and when subtracting the first number > > must be from 6-12, while the second is less than the first > > number. Here's my progress as of now: > > That is not a problem any sane human would need to solve, > especially the weird constructor restriction. > > see http://mindprod.com/jgloss/homework.html I'm guessing that the goal of the exercise is to generate random addition and subtraction problems for homework or testing. Instead of a constructor, perhaps a static factory method might be in order: <http://mindprod.com/jgloss/factorymethod.html> <http://www.drdobbs.com/jvm/creating-and-destroying-java-objects-par/208403883> An acquaintance was always amused when her online math homework posed an exact duplicate. Because the problem space is small, it might be possible to construct a complete List<Problem> and use Collections.sort() to avoid repetition. -- John B. Matthews trashgod at gmail dot com <http://sites.google.com/site/drjohnbmatthews>
Back to comp.lang.java.help | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Need to create a default constructor that generates 2 random questions. I'm fairly new to programming sunnyaleem@gmail.com - 2013-04-12 16:11 -0700
Re: Need to create a default constructor that generates 2 random questions. I'm fairly new to programming Eric Sosman <esosman@comcast-dot-net.invalid> - 2013-04-12 20:26 -0400
Re: Need to create a default constructor that generates 2 random questions. I'm fairly new to programming Roedy Green <see_website@mindprod.com.invalid> - 2013-04-14 04:07 -0700
Re: Need to create a default constructor that generates 2 random questions. I'm fairly new to programming "John B. Matthews" <nospam@nospam.invalid> - 2013-04-14 13:30 -0400
Re: Need to create a default constructor that generates 2 random questions. I'm fairly new to programming markspace <markspace@nospam.nospam> - 2013-04-14 11:57 -0700
Re: Need to create a default constructor that generates 2 random questions. I'm fairly new to programming Lew <lewbloch@gmail.com> - 2013-04-14 18:48 -0700
csiph-web