Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.help > #2680
| From | markspace <markspace@nospam.nospam> |
|---|---|
| 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 11:57 -0700 |
| Organization | A noiseless patient Spider |
| Message-ID | <kkeu13$l7i$1@dont-email.me> (permalink) |
| References | <063e6687-49a9-49d6-b7d4-29fd86115329@googlegroups.com> <qc3lm85qcq7usmh1ph9an44j2mskps43o1@4ax.com> <nospam-559D38.13302014042013@news.aioe.org> |
On 4/14/2013 10:30 AM, John B. Matthews wrote: > 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 I think using a ctor for the OP's problem is fine. We're definitely getting to the point here where there's a surfeit of advice. I object to file I/O in a ctor, it's gauche. Almost anything else is fine, as long as you adhere to best practice and avoid things like this-escape and so forth. The OP's ctor is probably about 7 lines of code. That's pretty trivial for a ctor, imo. The OP's main problem is he doesn't seem to understand how to construct his if-statement to give him the output he needs. Well, that and a certain newbishness using the language overall, but that's to be expected.
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