Results 1 to 7 of 7
  1. #1
    JAM1996 is offline Member
    Join Date
    Sep 2012
    Location
    Utah
    Posts
    7
    Rep Power
    0

    Default Help . I am having problems

    There are 7 errors in this program that I am unable to locate due to inexperience. Please locate and tell me of all 7 errors. Include what the errors are and how to fix them .


    // A class that computes the sample statistics of the ages of
    // family members.
    public class FamilyStats
    {
    public static void main(String[] args)
    {
    /*
    math equations obtained from: */
    Sample Variance -- from Wolfram MathWorld

    // define some ages

    int momsAge= 42; dadsAge= 43;
    int myAge= 22, sistersAge= 16;
    int dogsAge= 6;

    // get the mean

    double ageSum = (momsAge + dadsAge + myAge + sistersAge + DogsAge);
    double average = ageSum / 5

    / calculate the sample variance
    double variance= 0.0;
    variance += (momsAge - average)*(momsAge - average);
    variance += (dadsAge - average)(dadsAge - average);
    variance += (myAge - average)*(myAge - average);
    variance += (sistersAge - average)*(sistersAge - average);
    variance += (dogsAge - average)*(dogsAge - average);
    variance = variance / 4;

    // get the std. dev
    double standardDev= Math.sqrt(variance);
    // output the results
    System.out.println(The sample age mean is: + average);
    System.out.println("The sample age variance is: " + variance);
    System.out.println("The sample age standard deviation is: " + standardDev);
    }

  2. #2
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    12,224
    Rep Power
    20

    Default Re: Help . I am having problems

    Please use [code] tags [/code] when posting code.
    A lot of people here won't bother reading unformatted code.

    You also need to post the errors you are getting and what line(s) they are occurring on.
    AGain, most people here will not copy/paste code into an IDE to find out where your code is not compiling.
    Please do not ask for code as refusal often offends.

    ** This space for rent **

  3. #3
    JAM1996 is offline Member
    Join Date
    Sep 2012
    Location
    Utah
    Posts
    7
    Rep Power
    0

    Default Re: Help . I am having problems

    what do u mean by
    Java Code:
     tags
    ?

  4. #4
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    12,224
    Rep Power
    20

    Default Re: Help . I am having problems

    Exactly what I said.
    Look at your second post.
    If your code in your original post were wrapped in tags like that then it would retain its formatting.
    Please do not ask for code as refusal often offends.

    ** This space for rent **

  5. #5
    PhQ's Avatar
    PhQ
    PhQ is offline Senior Member
    Join Date
    Mar 2010
    Location
    Lithuania
    Posts
    358
    Rep Power
    5

    Default Re: Help . I am having problems

    I posted every single mistake and I have a feeling that I have done your homework. So I deleted them.
    I think those were all syntax errors.
    To fix them all read through these : http://docs.oracle.com/javase/tutorial/
    By the end you will most probably know what's wrong with the code.
    Last edited by PhQ; 09-26-2012 at 07:27 PM.

  6. #6
    DarrylBurke's Avatar
    DarrylBurke is offline Forum Police
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,458
    Rep Power
    20

    Default Re: Help . I am having problems

    Please go through the Forum Rules -- particularly the third paragraph.

    db
    If you're forever cleaning cobwebs, it's time to get rid of the spiders.

  7. #7
    Reeling is offline Member
    Join Date
    Jan 2012
    Posts
    49
    Rep Power
    0

    Default Re: Help . I am having problems

    I'm semi new to programming, and I find using a good IDE to be EXTREMELY USEFUL for finding these types of errors. You should look in to getting one.
    Also, I concur with everyone else has said so far.

Similar Threads

  1. InputStream/Jar Problems/File IO Problems
    By rdjava in forum Advanced Java
    Replies: 31
    Last Post: 01-17-2011, 12:12 PM
  2. JAR problems
    By Evil Smurf in forum New To Java
    Replies: 4
    Last Post: 09-01-2009, 02:17 AM
  3. Few Problems Help!
    By elad_bj in forum New To Java
    Replies: 4
    Last Post: 04-07-2009, 04:45 AM
  4. Problems in JSP : Need help
    By raj4u in forum JavaServer Pages (JSP) and JSTL
    Replies: 1
    Last Post: 02-07-2008, 11:06 AM
  5. gui problems
    By bluebirdjc in forum Advanced Java
    Replies: 2
    Last Post: 07-23-2007, 06:38 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •