81-90 : *****
71-80 : ***
Where each student represents an *.
I am not expecting any handouts, but I am so incredibly frusterated by this. I have been working for hours with minimal progress. Any help is much appreciated
EDIT: Specifically, I am having trouble with treating numStudents as a double. I had it as an int before, and thought I was making good progress on the program only to realize that it needed to be a double and I needed to make significant changes in my code. My compiler gives me the error message of "no suitable method found for nextInt(java.lang.String)" while highlighting ".nextInt" in my first while loop. Also, updated code:
Brian Mart wrote:Specifically, I am having trouble with treating numStudents as a double. I had it as an int before, ...
Why did you make it a double? Is the number of students ever a fractional number, for example there are 13.5 students?
Brian Mart wrote:My compiler gives me the error message of "no suitable method found for nextInt(java.lang.String)" while highlighting ".nextInt" in my first while loop.
You are trying to call the nextInt method on a Scanner object. For some reason, you are passing askNum (a String) to the method. But class Scanner does not contain a nextInt method that takes a String (see the API documentation). What are you trying to do there; why are you passing askNum to the nextInt method? What do you expect line 21 to do:
Lines 38 and 43 seem to be reversed.
I copied this into Eclipse and receive a bunch of errors:
For example: (line 69)
You don't even define "number".
and: (line 81)
What is "system"? Hint, you have it correct at lines 77 and 78.
Fix the trivial issues first, then we can help on the larger ones.
Why are you using System.exit()? It is a bit vicious. It will work in this sort of simple application, but in a threaded application can cause a thread to terminate before it has finished its task, and might corrupt files, etc.
If you are using JOptionPane (a very old‑fashioned idiom, but it still works), why not use the YES_NO_OPTION, then you can use YES/NO buttons to continue or stop. Much easier than entering “y” and less error-prone in case somebody writes “Y”. Why are you not using a loop to go back to the start if you click YES? If you read through the JOptionPane documentation, you can find out about it. You can also, if you look hard enough, work out how to get RANDOM or ENTER_MYSELF buttons displayed on an option pane dialogue.
Why are you using nextGaussian at all?
Why are all your methods static?
Does your code compile? I can see some things which I think the compiler wouldn’t be happy about.