• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Bear Bibeault
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Jj Roberts
  • Carey Brown
Bartenders:
  • salvin francis
  • Frits Walraven
  • Piet Souris

Write a public instance method called runExperiments() which takes no argument and returns no value?

 
Ranch Hand
Posts: 91
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The method should attempt to decrement powerLevel by a random number between 1 and 3 inclusive for each experiment up to numberOfExperiments. You should make use of the supplied helper method randomInteger() for this.

• If the powerLevel can be reduced, a message indicating the experiment number (starting at 1) should be displayed. If not, a suitable message should be displayed and remaining experiments should not be attempted.

• When all experiments have finished it should display "Experiment run stopped


 
Rancher
Posts: 4775
50
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What have you managed to write so far, and where are you stuck?
 
If you send is by car it's a shipment, but if by ship it's cargo. This tiny ad told me:
the value of filler advertising in 2020
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic