• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • paul wheaton
  • Ron McLeod
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:

compile error

 
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 32
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 4632
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 32
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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 ]
 
Sheriff
Posts: 7023
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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!
 
Dirk Schreckmann
Sheriff
Posts: 7023
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 32
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 32
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
reply
    Bookmark Topic Watch Topic
  • New Topic