import java.io.*;
import java.util.*;
public class lab11_2{
Scanner in=new Scanner(System.in);
private int month=12;
private int sum;
private int value;
private int rainfall;
private double total=0;
private double average;
private double standard_deviation;
private double largest;
private double smallest;
private double months[];
public lab11_2(){
months=new double[12];
}
public void setMonths(){
for(int n=1; n<=month; n++ ){
n=in.nextInt();
}
}
public double getTotal(){
double total=0;
for(int i=0; i<12;i++){
total=total+months[i];
System.out.println("The total rainfall for the year is"+ total);
}
return total;
}
public double getAverage(){
average=total/value;
System.out.println("The average rainfall of the year is"+ average);
total=in.nextDouble();
return getTotal()/12;
}
public double getLargest()
{
double largest=0;
for ( int i = 0; i < 12; i++)
{
if ( months[i] > largest)
{
largest = months[i];
System.out.println("The largest amount of rainfall was" +largest+"inches in month 8");
}
}
return largest;
}
public double getSmallest()
{
double smallest = value;
for ( sum = 1; sum < month; sum++)
{
if (value < smallest )
{
smallest = value;
System.out.println("The smallest amount of rainfall was" +smallest+"inches in month 11");
}
}
return smallest;
}
public double getStandard_deviation(){
double n = 0;
standard_deviation=Math.sqrt(n);
n=Math.pow(((rainfall-average, 2.0)/months-1)));
}
public static void main(String[]args){
lab11_2 r =new lab11_2();
System.out.println("Enter the rainfall (in inches) for month #1:");
System.out.println("Enter the rainfall (in inches) for month #2:");
System.out.println("Enter the rainfall (in inches) for month #3:");
System.out.println("Enter the rainfall (in inches) for month #4:");
System.out.println("Enter the rainfall (in inches) for month #5:");
System.out.println("Enter the rainfall (in inches) for month #6:");
System.out.println("Enter the rainfall (in inches) for month #7:");
System.out.println("Enter the rainfall (in inches) for month #8:");
System.out.println("Enter the rainfall (in inches) for month #9:");
System.out.println("Enter the rainfall (in inches) for month #10:");
System.out.println("Enter the rainfall (in inches) for month #11:");
System.out.println("Enter the rainfall (in inches) for month #12:");
r.setMonths();
System.out.println(" Total" + r.getTotal());
System.out.println("Smallest" + r.getSmallest());
System.out.println("Largest" + r.getLargest());
System.out.println("Average" + r.getAverage());
}
}
Im getting errors finding the standard deviation, also the program wont let me input the rainfall for each of the months...
can you guys help me?