import java.util.Scanner;
public class ParallelArrays
{
public static void main(String[] args)
{
String[] names = { "Doc", "Grumpy", "Happy",
"Sleepy", "Dopey", "Sneezy", "Bashful" };
System.out.println("The average of the scores is " + getAverage());
System.out.println("Name : " + getNames() + "\tGrade: " +
getScores() + "\tMean Deviation: " + getMean());
}
private static String getNames()
{
String[] names = { "Doc", "Grumpy", "Happy",
"Sleepy", "Dopey", "Sneezy", "Bashful" };
}
private static double getScores()
{
final int NUM_STUDENTS = 7;
double[] scores = new double[NUM_STUDENTS];
double score = 0.0;
Scanner keyboard = new Scanner(System.in);
for (int i = 0; i <= 6 ; i++)
{
System.out.print("Enter " + getNames() + "'s score: ");
scores[i] = keyboard.nextDouble();
score = scores[i];
}
return score;
}
private static double getAverage()
{
double average = 0.0;
double total = 0.0;
Scanner keyboard = new Scanner(System.in);
for (int i = 0; i <= 6 ; i++)
{
total += getScores();
average = total / 7;
}
return average;
}
private static double getMean()
{
double mean = 0.0;
double average = 0.0;
for (int i = 0; i <= 6; i++)
{
mean = getScores() - getAverage();
}
return mean;
}
}
I need help to figure out the program..
the program should print out what you see from a file which I attached.
thank you..
Attached image(s)
This post has been edited by macosxnerd101: 24 November 2010 - 08:48 PM
Reason for edit:: Please use code tags

New Topic/Question
Reply




MultiQuote







|