Need Help on what should be easy

I'm supposed to make a random number generator between the values of 1-1000. All I can think of is how to get a single random number... How do I get 100?
A program "RandomDataAnalyzer" that generates a hundred random numbers between 0-1000 and adds them to a "DataSet". Print the avg and the max.

The average portion is added in here but I cannot figure out how to compare all the mins and maxs in an array to print the min and max. Sorry
import java.util.*;
public class RandomNumbers
     private int currentNumber;
     private int totalAmount;
     private double average;
     private int min;
     private int max;
     public void createRandomNumbers()
               Random rg = new Random();
               int[] numberStorage = new int[100];
               int count = 1;
               int arrayCount = 0;
               do
                         currentNumber = rg.nextInt(1000);
                         numberStorage[arrayCount] = currentNumber;
                         System.out.println(count + ". " + currentNumber);
                         totalAmount = totalAmount + currentNumber;
                         count++;
                         arrayCount++;
                    }while (count <= 99)
                         currentNumber = rg.nextInt(1000);
                         numberStorage[arrayCount] = currentNumber;
                         System.out.println(count + ". " + currentNumber);
                         totalAmount = totalAmount + currentNumber;
                         System.out.println("All 100 nuumbers have been created");
                         average = totalAmount/100;
                         System.out.println("The average of the random numbers is: " + average);
     public static void main(String[] args)
               RandomNumbers rn = new RandomNumbers();
               rn.createRandomNumbers();
}

Similar Messages

  • I lost my ipod 5th generation,i left it in the backseat when i texted my dad saying to take my ipod to the house he said there wasn't anything back there so i need help of what should i do my dad might not buy me a new one!?

    i need help finding my ipod i look so many times around my car and i didnt find it but my dad might not find it! what should i do!?

    You have to enter the Apple ID and password. You are running into the Activation Lock
    iCloud: Find My iPhone Activation Lock in iOS 7
    Is there a way to find my Apple ID Name if I can't remember it?
    Yes. Visit My Apple ID and click Find your Apple ID. See Finding your Apple ID if you'd like more information.
    How do I change or recover a forgotten Apple ID Password?
    If you've forgotten your Apple ID Password or want to change it, go to My Apple ID and follow the instructions. SeeChanging your Apple ID password if you'd like more information.

  • Need Help..what should i use for this

    hello friends, i have to write a program which will load an xml file reader class at run time and depending on the content of xml file i'm going to generate mapping.. e.g xml file- <MyMapping> <ATO> <security type=int> </ATO> <FIX> <symbol type=String> </FIX> </MyMapping> Now i want to change the content of xml file without restarting my running application..changes should be reflected at runtime... also my xml file will contain nearly 1000 lines..so in this case which technique should i use whether i use JAXB which will give the classes of my xml file or any other ?? Also if i use JAXB whether JAXB gives classes corrsponding to my xml nodes (e.g ATO.java as per above example).

    daitkarsachin wrote:
    hi ,
    here is my question again..my xml will have
    <Message>
    <ATO>
    <somefiled="X" type=int value=35 />
    </ATO>
    <FIX>
    <somefiled="Y" type=String value=50 />
    <FIX>
    </Message>
    Now first i have to parse this xml ..then my java program is going to accept value from user ..and depending on user specified value i've to use either ATO or FIX fields...e.g if user value is 35 then my program should use fields within ATO node.
    You will read the XML structure into some kind of memory model. When the user supplies a value you will search for a matching value (likely from a collection such as a map or list) and return the value in that object that you locate.
    what should be done for this ..
    See above.
    and what if i change values in my xml file..will i have to restart my application to load xml again ?
    If you change the file on the filesystem, you should simply be able to re-parse the XML file and update your in-memory model. If you instead update your in memory-model, you can serialize the model back to XML on the filesystem. Neither needs to necessarily have anything to do with application start-up (other than the fact that you would normally read in the XML model then, but updating is a separate concern, as would re-reading it).
    - Saish

  • HT3775 Hi, my mac which is on 10.7.5 osx. but when ever i insert any mpeg/avi video cd it shows the file format not recognized. i am fed up of this. plz somebody help me. what should i do now.

    hi,
              i am using 10.7.5 lion there are a lot of problems in this OS.
    like most of the programs quit's unexpectedly. some programs does not work on it. like adobe cs5 is not working. everytime time when i do click on adobe cs 5 icon it shows a message "To open “Adobe Photoshop CS5,” you need to install a Java SE 6 runtime, but you are not connected to the Internet.To install a Java SE 6 runtime later, open “Adobe Photoshop CS5” again" while i always remain connected on the net.
    2. when ever i insert an avi or mpeg video disk it shows the file format not recognized. to **** with this macbook pro n its 10.7.5 lion. the same disk works/runs on windows on windows systems.
    plz somebody help me what should i do now.
    [email protected]

    it sounds like a fualty installation of Lion, this may happen from time to time.
    The best thing to do in this situation is to reinstall Lion. You will not loose anything doing this, but you should always keep back ups of your information.
    http://www.apple.com/osx/recovery/
    basically hold Cmd+R on boot..
    first go to disk utility, verify and repair your disks and permissions. Exit out of Disk utility and then go directly to "reinstall Lion"
    choose that and let it reinstall.
    Adobe CS6 does need Java to run.
    To play your movies you might need to get an application called VLC. VLC is a free app and will play most videos and music files you throw into it.
    http://www.videolan.org/vlc/download-macosx.html
    you have a 64bit intel mac, so get the one for that.

  • The left side of my home button is screen is kinda feel like hollow when I tap it and it makes a sound too. It is bulge,a little. I thought every ipad is hard to touch but why mine is not? Help please,what should I do?

    The left side of my home button is screen is kinda feel like hollow when I tap it and it makes a sound too. It is bulge,a little. I thought every ipad is hard to touch but why mine is not? Help please,what should I do? Please I need your help.

    The damage has been done then
    Take it to Apple and pay for a replacement
    Here in the States a replacement cost $229
    Allan

  • I already verify my app id but when i signed in my apple id it is still need to verify?? i try to verify again but when i click verify now then it said i verified it already but when i signed in it again..... it still need to verify. what should i do

    i already verify my app id but when i signed in my apple id it is still need to verify?? i try to verify again but when i click verify now then it said i verified it already but when i signed in it again..... it still need to verify. what should i do???

    That usually means that y ohave to add a valid payment to your account. Unless you initially set up the account withoeur a credit card
    Creating Apple ID without credit card: Apple Support Communities
    You need a valid payment method even for free stuff

  • I recently sold my iphone 4s back to at&t and bought a galaxy s5 but my brother still has an iphone and when he sends me a text it dosnt always go through and i really need help on what to do next please

    I recently sold my iphone 4s back to att and they whiped it clean and now i have a galaxy s5 and my brother still has the iphone but when he sends me texts they dont always go through and i need help on what to do next

    See if this helps:
    iMesssage to old phone
    If you move to another phone and forget to turn off iMessage then read “if you no longer have the device inhttp://support.apple.com/kb/HT5661  If you still cannot resolve it call Apple http://support.apple.com/kb/HE57
    To deactivate iMessage http://support.apple.com/kb/ts5185
    Read http://m.samsung.com/us/support/SupportOwnersFAQPopup.do?faq_id=FAQ00053450&fm_s eq=62995

  • My iPhone 4S won't turn on it's been off for two days now. I tried charging it but it makes a noise every 8 seconds,holding the buttons down and also plugging it to a computer. I need help on what to do or if anybody can tell me what's wrong with my phone

    My iPhone 4S won't turn on it's been off for two days now. I tried charging it but it makes a noise every 8 seconds,holding the buttons down and also plugging it to a computer. I need help on what to do or if anybody can tell me what's wrong with my phone

    Yes ive tried a different charger and it also nothing shows when i plug it in just makes a noise

  • The safari software will not display images (pictures).  I have done the "reset" but still no help.  What should i try next?

    the safari software will not display images (pictures).  I have done the "reset" but still no help.  What should i try next?

        Safari > Preference > Advanced
        Checkmark the box for "Show Develop menu in menu bar".
        "Develop" menu will appear in the Safari menu bar.
        Click Develop and make sure that"Disable Images" is not enabled in the dropdown.

  • TS3682 I started updating my iPhone 4, but it went black screan and then started turning on and off non stop. I tried to hold the two buttons, but nothing different happened. Please, help! What should I do?!

    I started updating my iPhone 4, but it went black screan and then started turning on and off non stop. I tried to hold the two buttons, but nothing different happened. Please, help! What should I do?!

    First see if placing the iPod in Recovery Mode will allow a restore.
    Next try DFU mode and restore.
    How to put iPod touch / iPhone into DFU mode « Karthik's scribblings
    If not successful then time for an appointment at the Genius Bar of an Apple store. You are not alone with this problem.

  • Yosemite made my MacBook Pro so slow !! Need help ? what is the solution?

    Yosemite made my MacBook Pro so slow !! Need help ? what is the solution?

    I've ran a benchmark on my Mac (iMac early 2009). Performance of Yosemite in general was about the same as Mavericks. But that can be different on other Mac's of course. Safari is mostly a bit slower. It's recommended you clean your old internet-caches and then restart Safari. (you can use a little app called CCleaner to do that). That might make a difference. Speed-issues are usually solved in the first and second update of OS X.

  • My phone i disabled.when i connected it to the pc to restore and update it..my iphone after 5 mins goes restart? plz help me what  should i do

    my phone i disabled.when i connected it to the pc to restore and update it..my iphone after 5 mins goes restart? plz help me what  should i do

    The Basic Troubleshooting Steps are:
    Restart... Reset... Restore from Backup...  Restore as New...
    Malvinfromny wrote:
    ... i tried to restore it but when i do the phone does half of the steps and then it turns into a blue screen and it doesnt work again what can i do?
    If you try all these Steps and you still have issues... Then a Visit to an Apple Store or AASP (Authorized Apple Service Provider) is the Next Step... Be sure to make an appointment first...

  • Ipad didnt work, i cant go back to the apps, and even i cant reboot the ipad. please help me, what should i do with my ipad? thank you.

    i read a book from ipad, when i want to change to a game, suddenly the ipad stuck. i cant go back home or even reboot from the turn on/off button, and now the ipad stuck. please help me, what should i do? thank you.

    If "Demo's" instructions helped...
    when i want to change to a game,
    Tap and hold down the app then tap the x with a circle then tap Delete.
    User your iPad for a few days to see if it's stable. If it is, then it's that one app causing the problem.
    Contact the app's developer (at their website) for support.

  • My iphone 5 gets hot while using it and while charging too.... Please help me what should i do?? Should i replace the battery....??  Because it gets hot even within 5 minutes also....  And it is happening from 2 weeks daily.

    My iphone 5 gets hot while using it and while charging too.... Please help me what should i do?? Should i replace the battery....??  Because it gets hot even within 5 minutes also....  And it is happening from 2 weeks daily.

    The Basic Troubleshooting Steps are:
    Restart... Reset... Restore from Backup...  Restore as New...
    Restart / Reset   >  http://support.apple.com/kb/ht1430
    Backing up, Updating and Restoring  >  http://support.apple.com/kb/HT1414
    If you try all these steps and you still have issues... Then a Visit to an Apple Store or AASP (Authorized Apple Service Provider) is the Next Step...
    Be sure to make an appointment first...

  • IOS6 and iphoto, iPad, Apple TV sync problem still unresolved. Turning on and off a few times have not helped. What should I do now? wait for an upgrade fix?

    iOS6 and iphoto, iPad, Apple TV sync problem still unresolved. Turning on and off a few times per community advice have not helped. What should I do now? wait for an upgrade fix?
    "&" is not the obvious bug/answer. Not sure what went wrong as I cannot select albums and events for sync. Situation is worse for iPad and Apple TV when error 1140 message popped up even before backup get completed.

    Download and install the iPhoto 9.4.1 update, which was just released today. It may be the answer to your problems:
    http://support.apple.com/kb/DL1598
    Be sure that neither iTunes nor iPhoto is running when you install the iPhoto 9.4.1 update. After installing the update, then restart iTunes and iPhoto. By default, "All photos" is selected. Change this (it's no longer grayed out) to "Selected albums..." and you should be OK.

Maybe you are looking for