I need someone to review my program and tell me why it won't work

I can't get this to work. It's a program that generates a set of random numbers, stores them as a .txt file then a second program imports that data and sorts it in descending order and displays the average and median of the data. If this is too messy and there is a better way to post these programs please tell me and I will repost. Sorry about the messyness but here you go:
It's two separate .java files.
RandMarks.java:
import java.io.*;
public class RandMarks
public static void main (String [] args) throws IOException
int randomNum;
PrintWriter fileOut = new PrintWriter (new FileWriter ("marks.txt"));
for (int i = 1; i <= 25; i++)
randomNum = (int) (Math.random () * 60 + 40);
fileOut.println (randomNum);
fileOut.close ();
IcsMarkbook.java:
import java.io.*;
public class IcsMarkbook
public static void main (String [] args) throws IOException
BufferedReader readFile = new BufferedReader (new FileReader ("marks.txt"));
int inMarks [] = new int [25];
int avgMark, medMark;
int totalMarks = 0;
for (int i = 0; i < 100; i++)
inMarks = Integer.parseInt (readFile.readLine ());
bubbleSort (inMarks);
for (int p = 0; p < inMarks.length; p++)
System.out.println ("#" + p + " - " + inMarks [p]);
totalMarks = totalMarks + inMarks [p];
avgMark = totalMarks / inMarks.length;
System.out.println ("The average is " + avgMark);
medMark = inMarks [13]
public static void bubbleSort (int array [])
for (int pass = 0; pass < array.length - 1; pass++)
for (int element = 0; element < array.length - 1; element++)
if (array [element] > array [element + 1])
swap (array, element, element + 1);
//Swap method
public static void swap (int array2 [], int first, int second)
int hold;
hold = array2 [first];
array2 [first] = array2 [second];
array2 [second] = hold;

RandMarks.java:
import java.io.*;
public class RandMarks
     public static void main (String [] args) throws IOException
          int randomNum;
          PrintWriter fileOut = new PrintWriter (new FileWriter ("marks.txt"));
          for (int i = 1; i <= 25; i++)
               randomNum = (int) (Math.random () * 60 + 40);
               fileOut.println (randomNum);
          fileOut.close ();
}IcsMarkbook.java:
import java.io.*;
public class IcsMarkbook
     public static void main (String [] args) throws IOException
          BufferedReader readFile = new BufferedReader (new FileReader ("marks.txt"));
          int inMarks [] = new int [25];
          int avgMark, medMark;
          int totalMarks = 0;
          for (int i = 0; i < 100; i++)
               inMarks = Integer.parseInt (readFile.readLine ());
          bubbleSort (inMarks);
          for (int p = 0; p < inMarks.length; p++)
               System.out.println ("#" + p + " - " + inMarks [p]);
               totalMarks = totalMarks + inMarks [p];
          avgMark = totalMarks / inMarks.length;
          System.out.println ("The average is " + avgMark);
          medMark = inMarks [13]
     public static void bubbleSort (int array [])
          for (int pass = 0; pass < array.length - 1; pass++)
               for (int element = 0; element < array.length - 1; element++)
                    if (array [element] > array [element + 1])
                         swap (array, element, element + 1);
     //Swap method
     public static void swap (int array2 [], int first, int second)
          int hold;
          hold = array2 [first];
          array2 [first] = array2 [second];
          array2 [second] = hold;
}The message that I got was:
Exception in thread "main" jaja.lang.NumberFormatException: null
        at java.lang.Integer.parseInt(Integer.java:415)
        at java.lang.Integer.parseInt(Integer.java:497)
        at IcsMarkbook.main(IcsMarkbook.java:13)
I have gone over the program multiple times and cannot figure out what's wrong.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

Similar Messages

  • Can someone run this for me and tell me what it prints out?

    I am on a computer that does not have BlueJ or anything of the sort and I need to check if this compiles and prints out the correct number. If someone could, please do so and tell me what it prints.
    Thank you
    public static void mystery(int m)
    if (m == 0)
       return 1;
    else
    return 3 * mystery(m - 1);
    }

    Alan.L.Brown wrote:
    What's a "scut-puppy"?Someone who is forced to do low-level dirty work, "scut" work. Scut is a medical term for tasks that medical students and residents don't like doing, such as drawing blood, running something to the lab, starting IV's, lumbar punctures. Usually the low-man on the totem pole who gets assigned to do the scut work is the scut-puppy.

  • Had to purchase two OS X system upgrades, new iPhoto etc. just to connect new iPhone 5 and now half my apps won't work. No rosetta and missing lost dogs pics from iCloud...HELP!

    I had to purchase two OS X system upgrades, snow leopard and mountain lion,  just to connect my new iPhone 5 and somewhere between uploading iPhone 4S pics to iCloud some important pics disappeared then installed new iTunes and purchased new iPhoto all  just to connect new iPhone 5 and now half my apps won't work. No Rosetta to make apps work but its not as simple as upgrading apps and missing lost dogs pics from iCloud...HELP!

    File a complaint with Apple for not giving adequate warning before upgrading OS X that it would render PPC programs dead.
    That someone at Apple said requiring the iPhone 5 to have 10.8 (10.6.8 is the minimum actually) and in order to remain a loyal Apple customer they need to fix this mess and revert your machine and software back to 10.6.8
    You see, 10.6.8 would have ran your iPhone 5 and ran your PPC based software, so whoever told you to upgrade to 10.8 was wrong and they need to fix your machine.
    It can be reverted to 10.6.8 yourself.
    How to revert your Mac to Snow Leopard
    Most commonly used backup methods

  • TS3988 I changed my Apple ID to my new email address successfully for the iTunes and App store but it won't work for iCloud and it won't recognize my password. I read that this can't be done. How am I supposed to get into iCloud?

    I changed my Apple ID to my new email address successfully for the iTunes and App store but it won't work for iCloud and it won't recognize my password. I read that this can't be done. How am I supposed to get into iCloud? I plan on getting rid of my old email address which is my old Apple ID so how is that going to work?

    Same question Wish someone had replied!
    I changed my Apple ID to my new email and now cannot find any way to access icloud. Unfortunately I had allowed icloud to hijack my airbook files, so of course I am afraid I will lose them tomorrow when I exchange my iphone for a new one and cannot keep an icloud account i cannot access. What a poor sync system! Really atypical for apple!

  • I have seen on this community that the earpods do not work on iPod shuffle gen 3 but when I was using on them it worked the control panel thing that is but only until I turned it off I don't understand why it won't work again and why it did in the first p

    I have seen on this community that the earpods do not work on iPod shuffle gen 3 but when I was using on them it worked the control panel thing that is but only until I turned it off I don't understand why it won't work again and why it did in the first place can someone please explain and tell me how to make it work again

    Sorry first time asking question didn't mean to write same thing twice well copy paste

  • Programs that require a network connection won't work because there is no virtual IP address available for this session.

    Programs that require a network connection won't work because there is no virtual IP address available for this session.  Per application IP virtualization is enabled.
    There are in fact available IP address's within the dhcp scope.  Before I dig to deep into root cause.. Could the problem be RDS CAL licensing running out, or isn't that not a symptom of my error message?

    Hi,
    Thank you for posting in Windows Server Forum.
    As per my research, there is no any issue related to RDS CAL licensing. Prior to the issue which you are facing, there are some basic setting which need to configure.
    Application Compatibility – Turn on Remote Desktop IP virtualization
    Some applications require a unique IP address, which is by default logically not the case if the application is running on RD Session Host. To solve this issue, Remote Desktop IP Virtualization is introduced. With this setting you enable the IP virtualization
    feature. When enabling this setting you need to specify if the virtual IP is provided per session or per program. When using per program you need to define the executable to which an IP address should be configured. Desktop IP virtualization also needs the
    configuration of the next setting.
    Application Compatibility – Select the network adapter to be used for Remote Desktop IP Virtualization
    When you need to use Remote Desktop IP virtualization configuring this setting is mandatory. You need to specify the IP address of the Network Interface Card which should be used for this feature. Besides the IP address you need also to specify the network
    mask using the slash notation, for example 192.168.77.201/24.
    Application Compatibility – Do not use Remote Desktop Session Host server IP address when virtual IP address is not available
    More information:
    Microsoft RDS Policies explained (Part 2)
    http://www.virtualizationadmin.com/articles-tutorials/vdi-articles/microsoft-hyper-v/microsoft-rds-policies-explained-part2.html
    Configuring Remote Desktop IP Virtualization II
    http://blogs.msdn.com/b/rds/archive/2009/07/15/configuring-remote-desktop-ip-virtualization-ii.aspx
    Hope it helps!
    Thanks.
    Dharmesh Solanki

  • HT203180 shows (I already of 5 of them) now it says they can't be played on my ipod, and I purchased them from Itunes? I don't understand why they won't work?

    I purchased the remainder of shows (I already of 5 of them) for a TV series now it says they can't be played on my ipod, and I purchased them from Itunes? I don't understand why they won't work? I tried the conversion but it's greyed out and not chooseable. But again purchased from itunes so they should work according to the above article. Can anyone help me?

    Dracwolley wrote:
    They can. The video needs to be converted, though. If it's in your library, just go to Advanced (in the top menu), then click on "Make iPod/iPhone Version." Wait a while, and when it's done, click and drag. Or for a quicker alternative and less space lost on the iPod, download Handbrake here.
    Yep.

  • Windows 7 and dv4-1125nr TrackPad - scrolling won't work

    I have installed all the latest drivers via HP support's website and the trackpad's scrolling won't work on my dv4-1125nr when in Windows 7. It works fine in Vista, so I'm wondering if there is a way to get it working properly in Win 7. Also the software update manager is not available for download under my model number. If that was available, perhaps that would find a necessary download and install accordingly. Any help is greatly appreciated as this is a major annoyance!! Thanks!

    Hi Daniel, thanks for your post, recently I also upgraded my laptop(dv4-1125nr) from vista to Win 7 ultimate, after then my touchpad(touch keys just above the keyboard, it contain mute, vol. up or down, wireless active or inactive) is not able to work.
    You informed that we need uninstall and then install Synaptics touchpad for Win7 by HP here
    I would like to know which driver i need to uninstall and then install above one and even i attached my laptop contral panel screen shot for your reference. your help is highly appreciated.
    Thanks,
    Praveen Kumar. K

  • I installed iTunes 10.5.3.3 and now my DVD player won't work.

    I installed iTunes 10.5.3.3 and now my DVD player won't work and has this error:
    This device cannot start. (Code 10)
    Click 'Check for solutions' to send data about this device to Microsoft and to see if there is a solution available.
    Any ideas why iTunes renders my DVD drive unusable?  I have uninstalled and reinstalled iTunes and when reinstalling I had my device manager open and saw during the installation how my DVD player went from accessible to not being able to start.
    Why is this happening? 
    Here is my computer information:
    Dell
    Latitude D630
    Intel Core  Duo CPU T770 @2.40 Hz
    4.00 GB RAM
    32-bit Operating System
    Thank you,
    Kelly

    There's a few different possibilities with a code 10, Kelly. To narrow in on the likeliest culprits it would help to have a closer look at your system.
    Could you post your diagnostics for us please?
    In iTunes, go "Help > Run Diagnostics". Uncheck the boxes other than DVD/CD tests, as per the following screenshot:
    ... and click "Next".
    When you get through to the final screen:
    ... click the "Copy to Clipboard" button and paste the diagnostics into a reply here.

  • I have Macbook Pro and Adobe CC. 3D won't work.. I can open the 3D panel options but clicking ok or even choosing preview brings up an error message [can't]

    I have Macbook Pro and Adobe CC. 3D won't work.. I can open the 3D panel options but clicking ok or even choosing preview brings up an error message [can't]
    My friend has exact same Mac and CC and he has the same problem. We both have up to date Yosemite and CC versions.
    Any ideas?

    Hi,
    Could you please confirm the CC application you are using.
    It would be great if you post a screenshot of the problem.
    Regards,
    Sumit Singh

  • HT2486 I just upgraded to 10.6.3 and now my address book won't work (4.1.2) how to I upgrade it?

    I just upgraded to 10.6.3 and now my address book won't work (4.1.2) how to I upgrade it?

    Software Update (under the Apple menu).
    Current Snow Leopard version is 10.6.8.

  • I upgrades my mac operating system to OSX 10.9.4 and now my Dreamweaver CS5 won't work, it just quits unexpectedly.  please help.

    I upgrades my mac operating system to OSX 10.9.4 and now my Dreamweaver CS5 won't work, it just quits unexpectedly.  Please help.

    Remove preferences on Mac OS
    Quit Dreamweaver.
    In the Finder, navigate to /Users/Your User Name/Library/Application Support/Adobe.
    Rename the Dreamweaver preferences folder:
    Dreamweaver CS5: Rename the Dreamweaver CS5 folder to, for example, Old Dreamweaver CS5.
    Navigate to /Users/Your User Name/Library/Preferences.
    Rename the Dreamweaver preferences file:
    Dreamweaver CS5: Rename the Adobe Dreamweaver CS5 Prefs file to, for example, Old Adobe Dreamweaver CS5 Prefs.
    Try to re-create problem
    After you have removed your existing preferences, restart Dreamweaver. The application creates new preferences files, folders, and registry entries, as applicable, using the default settings.
    Then try to re-create the problem that you had before.
    If the problem was resolved, then damaged preferences was the cause.
    If the problem persists, then the preferences are not the cause and you can replace the original preferences.
    To replace the original preferences:
    Quit dreamweaver.
    Delete the new preferences folder and restore the original name of the previous folder.

  • I recently upgraded my Macbook Pro with OS X and now my HP printer won't work. Can anyone help?

    I recently upgraded my Macbook Pro with OS X and now my HP printer won't work. Can anyone help?

    Visit HP's support site to see about downloading an updated driver. Or you can check at support.apple.com/downloads/ for new HP printer drivers package.

  • I am trying to set up the ipod to my email account and it keeps saying it won't work, even though we have confirmed user name and password.  Any advice?

    i am trying to set up the ipod to my email account and it keeps saying it won't work, even though we have confirmed user name and password.  Any advice?

    Try deleting the account from the iPod and try reentring all the information again.  A lot of times it is easier to reenter the information rather than trying to find and correct the error.
    Try Googling for how to setup the email account for your provider on an iPhone.  You can try for an iPod Touch but frequently that does not exist.

  • I'm using the sync option for when I'm not near my desktop and no matter what it won't work its telling me my account name or password is not correct and it is!

    I'm using the sync option for when I'm not near my desktop and no matter what it won't work its telling me my account name or password is not correct and it is!

    This is from my personal experience:
    It almost happens every time I tried to connect with Sync from my Android phone, the window asking me to enter my account name and password always shows up. And if I enter the information, it'll say I have the wrong password, etc. My workaround is to click the "cancel" button. But it does not cancel immediately. The window will stay on for a while (usually a few minutes), then it'll disappear and start connecting to Sync. And it'll connect and sync successfully.
    You can try this workaround but you have to be patient to wait for the window to disappear.
    I don't know what is the cause of this, but it has happened ever since FF4 for Mobile came out. I have searched around and couldn't find any solutions.

Maybe you are looking for