Post a New Question

Java programming

posted by on .

– 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.

  • Java programming - ,

    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);

  • Java programming - ,

    Oh, all the doubles have to be lower case.

  • Java programming - ,

    thank you..:)

Answer This Question

First Name:
School Subject:
Answer:

Related Questions

More Related Questions

Post a New Question