Please tell me what i did incorrect

There are 7 errors in the following program...Tell me what i did incorrect and tell me how to fix it. Also, tell me where the errors are located and what type of errors i made, if they have a specific name

Do not worry about the math calculations, abbreviations, or missing words in comments. But, I am unfamiliar with writing programs, so worry about the way it is written

// 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);

}

Re: Please tell me what i did incorrect

What are the errors?

I think you do need to change these int's in doubles:

int momsAge

Becasue else you won't get out a double value below hen you calculate the mean.

Als try putting your code between code tags.

Then it is easyer to read. :)

Re: Please tell me what i did incorrect

I do not know. I was told that i had 7 errors and i have looked at it for hours and havent found any, but there ARE 7 ...i am too inexperienced to notice them though :(

Re: Please tell me what i did incorrect

Can you copy paste the red text?

P.s. I adjusted my firts post.

Re: Please tell me what i did incorrect

Also I think by looking at you code, that dadsAge is not defined as an int/double.

Maybe you should make it:

double momsAge= 42;

double dadsAge= 43;

double myAge= 22;

double sistersAge= 16;

double dogsAge= 6;

Also you have a , between myAge and sistersAge.

That is sure causing 1 error.

Re: Please tell me what i did incorrect

// 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);

}

Re: Please tell me what i did incorrect

How do i put it in code tags?

Re: Please tell me what i did incorrect

And also mind the capital letters.

dogsAge = not the same as: DogsAge.

Good luck. :)

Re: Please tell me what i did incorrect

Remove the *

[*code]

code here

[*/code]

Re: Please tell me what i did incorrect

It says" '.class' expected." at double momsAge= 42;...how do i fix it?

Re: Please tell me what i did incorrect

I copy pasted your code in my program and these are your errors:

Your code

Code :

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

But since you need to define them all:

Code :

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

Also in your code you have a , between myAge and sistersAge.

And int cannot have text in it, only numbers.

And dogsAge = not the same as DogsAge.

And voila, it should work I think.

Re: Please tell me what i did incorrect

What if you would make it: 42.0?

(I am going home now, I am finished working, might look in this topic in 1 hours again. Good luck.)

Re: Please tell me what i did incorrect

still says class expected

Re: Please tell me what i did incorrect

Quote:

Originally Posted by

**Purple01**
Also you have a , between myAge and sistersAge.

That is sure causing 1 error.

The following line of code:

int myAge= 22, sistersAge= 16;

Is perfectly legal java syntax.

Re: Please tell me what i did incorrect

Quote:

Originally Posted by

**fh123boys**
still says class expected

Please post a fresh copy of the code and any error messages you have.