Hi All As might implement the following? ########################################################################### In a class of 30 students, 17 students collect figures on an album. The album is completed by pasting 70 figures, which are numbered 1 to 70. Each of the collectors has a different number of figures pasted on her album and it is almost as awards for the children meet with the intention to change but even more detect which are the figures called "difficult". Help these children, knowing the figures that each one of them has, to determine which are the most difficult and which child has more number of figures attached. Use random numbers and simulation strategy to generate the figures you have and not every child. ########################################################################### I accept any suggestions. thanks
on 2012-06-23 05:38
on 2012-06-23 08:12
Hi, It would have been nice if you'd told us your own thoughts on this taks or at least your level of Ruby knowledge. Now all we have is a rather vague description of your homework. I don't know how to measure "difficult" figures. If we assume that the children have all the figures they could get, then "difficult" probably just means rare. So there are two task: - find the child with the most figures - find the rarest figure For the implementation, I'd start by finding a good way to store the data: You have 17 data sets consisting of a name and a set of figure numbers (which may range from 1 to 70). Then you have to select the most diligent child and the rarest figure. You may want to look into the Enumerable#max_by method: http://ruby-doc.org/core-1.9.3/Enumerable.html#met...
Please log in before posting. Registration is free and takes only a minute.
Existing account
(Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
Log in with Google account | Log in with Yahoo account
No account? Register here.