I am very new to this and the computer programming world in general, and I'm having a problem with my program and I think I'm just making one little mistake, but I can't figure out what it is! I'm using class GetStats to be the main for my other class Stats and when I compile, I get the error message: "package Stats does not exist." Can anyone help? :(
import java.util.Scanner;
import java.lang.Math;
public class Stats{
static Scanner sc = new Scanner(System.in);
public static int[] integers() {
int[] num = new int[10];
for (int i = 0 ; i < num.length ; i++){
System.out.println("Enter an integer:");
num[i] = sc.nextInt();
}
return num;
}
public static void minMax(int[] numbers){
System.out.println("The min integer is " + minNum(numbers));
System.out.println("The max integer is " + maxNum(numbers));
System.out.println("The median is " + numbers[5]);
}
public static void mean(int[] numbers){
int sum = 0;
double average, ave, sd;
double sum2 = 0;
for(int i = 0; i < numbers.length; i++)
sum += numbers[i];
average = sum / 11;
for(int i = 0; i < numbers.length; i++){
sum2 += Math.pow(numbers[i] - average, 2);}
ave = sum2 / 11;
sd = Math.sqrt(ave);
System.out.println("The mean of the integers is " + average);
System.out.println("The standard deviation of the integers is " + sd);
}
public static int minNum(int[] numbers){
int curr = numbers[0];
for(int i = 0 ; i < numbers.length ; i++)
if (numbers[i] < curr)
curr = numbers[i];
return curr;
}
public static int maxNum(int[] numbers){
int curr = numbers[0];
for(int i = 0 ; i < numbers.length ; i++)
if (numbers[i] > curr)
curr = numbers[i];
return curr;
}
}
import java.util.Scanner;
import Stats.*;
public class GetStats{
public static void main(String [] args){
int[]num = Stats.integers();
Stats.minMax(num);
Stats.mean(num);
}
}