Results 1 to 7 of 7
Thread: Help . I am having problems
- 09-26-2012, 11:24 AM #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 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);
}
- 09-26-2012, 11:47 AM #2
Moderator
- Join Date
- Apr 2009
- Posts
- 10,481
- Rep Power
- 16
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.
- 09-26-2012, 05:22 PM #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
- 09-26-2012, 05:38 PM #4
Moderator
- Join Date
- Apr 2009
- Posts
- 10,481
- Rep Power
- 16
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.
- 09-26-2012, 06:16 PM #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.
- 09-26-2012, 07:35 PM #6
Re: Help . I am having problems
Please go through the Forum Rules -- particularly the third paragraph.
dbWhy do they call it rush hour when nothing moves? - Robin Williams
- 09-26-2012, 08:02 PM #7
Member
- Join Date
- Jan 2012
- Posts
- 49
- Rep Power
- 0
Similar Threads
-
InputStream/Jar Problems/File IO Problems
By rdjava in forum Advanced JavaReplies: 31Last Post: 01-17-2011, 11:12 AM -
JAR problems
By Evil Smurf in forum New To JavaReplies: 4Last Post: 09-01-2009, 01:17 AM -
Few Problems Help!
By elad_bj in forum New To JavaReplies: 4Last Post: 04-07-2009, 03:45 AM -
Problems in JSP : Need help
By raj4u in forum JavaServer Pages (JSP) and JSTLReplies: 1Last Post: 02-07-2008, 10:06 AM -
gui problems
By bluebirdjc in forum Advanced JavaReplies: 2Last Post: 07-23-2007, 05:38 PM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks