# Thread: I can't find anything wrong with this but somehow it's wrong.

1. Member Join Date
Sep 2012
Posts
4
Rep Power
0

## I can't find anything wrong with this but somehow it's wrong.

I'm in an AP CS class and I was given an assignment that required me to find and correct mistakes. I opened the program and it tells me (on BlueJ)after I try to compile it '.class' expected. I haven't gotten that far into my class to know what that means. Can anyone explain.
Java Code:
```public class FamilyStats
{
public static void main(String args [])
{
/*
math equations obtained from: */
http://mathworld.wolfram.com/SampleVariance.html

// define some ages
int momsAge= 42; int dadsAge= 43;   <---This line shows the first problem. 7 in all.
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);
}```   Reply With Quote

2. Senior Member  Join Date
Oct 2010
Location
Germany
Posts
787
Rep Power
11

## Re: I can't find anything wrong with this but somehow it's wrong.

-First, take a look at line 7 and 19 and fix the comments :D
-Count the braces
-check upper and lowercase
- ; is necessary in java
- compare each System.out to the other....  Reply With Quote

3. Member Join Date
Sep 2012
Posts
4
Rep Power
0

## Re: I can't find anything wrong with this but somehow it's wrong.

Thanks for the help. I guess I just needed someone lay it out differently.  Reply With Quote

#### Posting Permissions

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