# Thread: Help . I am having problems

1. Member
Join Date
Sep 2012
Location
Utah
Posts
7
Rep Power
0

## 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 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 += (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. Moderator
Join Date
Apr 2009
Posts
13,067
Rep Power
23

## 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.

3. Member
Join Date
Sep 2012
Location
Utah
Posts
7
Rep Power
0

## Re: Help . I am having problems

what do u mean by
Java Code:
` tags`
?

4. Moderator
Join Date
Apr 2009
Posts
13,067
Rep Power
23

## Re: Help . I am having problems

Exactly what I said.
If your code in your original post were wrapped in tags like that then it would retain its formatting.

5. ## 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 06:27 PM.

6. ## Re: Help . I am having problems

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

db

7. Member
Join Date
Jan 2012
Posts
49
Rep Power
0

## 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.

#### Posting Permissions

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