I have an assignment where the computer should simulate the roll of 3 dice 60000 times,sum the values determine the frequency of the numbers and the percentages. Problem: when try to compile I get an error message that says modifyArray(int) in lab5 cannot be applied to modifyArray(); Please help,I do not understand the message. Thank you for your help Nancy Here is my code
Michael Dunn
Ranch Hand
Joined: Jun 09, 2003
Posts: 4632
posted
0
To answer your specific question, the method signature for modifyArray() requires an int as an argument, which you don't provide when you call it. You have a number of other problems. Compare your code to this, to see the differences (this code does what I think you're trying to do)
Nancy Bradley
Ranch Hand
Joined: Feb 25, 2004
Posts: 32
posted
0
Thank you very much. I compile it,the frequencies are display, but not the percentages. Have a question. wcan I add the elements of tan array? Thank you Nancy
Michael Dunn
Ranch Hand
Joined: Jun 09, 2003
Posts: 4632
posted
0
The percentages showed OK for me. Your question, adding the elements of an array? Loop through the array adding the value at each element.
Nancy Bradley
Ranch Hand
Joined: Feb 25, 2004
Posts: 32
posted
0
Thank you for your help. I got it Another question. I need to add the % sign to the percentages, but it only displays on the las number Wahat did I do wrong? Thank you Nancy [ edited to break apart long lines -ds ] [ March 16, 2004: Message edited by: Dirk Schreckmann ]
Dirk Schreckmann
Sheriff
Joined: Dec 10, 2001
Posts: 7023
posted
0
Nancy, Welcome to JavaRanch! We ain't got many rules 'round these parts, but we do got one. Please change your display name to comply with The JavaRanch Naming Policy. Thanks Pardner! Hope to see you 'round the Ranch!
nother question. I need to add the % sign to the percentages, but it only displays on the las number Wahat did I do wrong? Perhaps you want to add a few percent signs to be output during the execution of your for-loop. (In other words, look inside your for-loop. It's not displaying any percent signs.)
Nancy Bradley
Ranch Hand
Joined: Feb 25, 2004
Posts: 32
posted
0
I already tried. Right after twoD.format(percent[x]), but then the applet never display any result at all. Thanks for your help Nancy
Nancy Bradley
Ranch Hand
Joined: Feb 25, 2004
Posts: 32
posted
0
Thank you very much for all your help. I was placing the % sign inside the parenthesis by mistake. That is why it did not work. Thank you again Nancy