Asked by noh

– One Dimensional Array
Consider this example problem: You are given 7 quiz scores of a student. You are to compute the final quiz score, which is the sum of all scores after subtracting the lowest one.
For example, if the scores are
8 7 8.5 9.5 7 5 10
then the final score is 50.

Answers

Answered by Alexis
double[] score = {8, 7, 8.5, 9.5, 7, 5, 10};
Double min = 10; //the highest possible score is 10
Double total = 0;
for(int i = 0; i < score.length; i++)
{
total += score[i];
if(score[i] < min)
{
min = score[i];
}
}
total -= min;

System.out.println("Total = " + total);
Answered by Alexis
Oh, all the doubles have to be lower case.
Answered by noh
thank you..:)
There are no AI answers yet. The ability to request AI answers is coming soon!

Related Questions