hello
i m trying to write a program in which program ask for user quiz score input and after user enter all the score then the program needs to drop the lowest score but i m keeping getting stuck at math.min method its keeping giving me errors. and i m unable to find the lowest score. this is what i got so far

/////////////////////////////////////////////////////////////////////////////////////////////////////
import jpb.*;
import java.lang.Math.*;
//package math;
import java.util.*;

public class quiz {
public static void main(String[] args) {
SimpleIO.prompt("\nEnter Quiz 1 score: ");
String userInput = SimpleIO.readLine();
double quiz1 = Convert.toDouble(userInput);

SimpleIO.prompt("Enter Quiz 2 score: ");
userInput = SimpleIO.readLine();
double quiz2 = Convert.toDouble(userInput);

SimpleIO.prompt("Enter Quiz 3 score: ");
userInput = SimpleIO.readLine();
double quiz3 = Convert.toDouble(userInput);

SimpleIO.prompt("Enter Quiz 4 score: ");
userInput = SimpleIO.readLine();
double quiz4 = Convert.toDouble(userInput);

SimpleIO.prompt("Enter Quiz 5 score: ");
userInput = SimpleIO.readLine();
double quiz5 = Convert.toDouble(userInput);

SimpleIO.prompt("Enter Quiz 6 score: ");
userInput = SimpleIO.readLine();
double quiz6 = Convert.toDouble(userInput);

double lowest_Quiz=Math.min(Math.min(quiz1,quiz2),Math.min(quiz3,quiz4),Math.min(quiz5,quiz6));

// Compute the quiz average from the five scores
double quizAverage =
(quiz1 + quiz2 + quiz3 + quiz4 + quiz5) / 5;
System.out.println(quizAverage);
}
}
//////////////////////////////////////////////////////////////////////////////////////////////////////
error i got is: cannot find a symbol method min(double,double,double)
/////////////////////////////////////////////////////////////////////////////////////////////////////

Recommended Answers

All 2 Replies

That's because there isn't such a method. If you check the API Math.min takes only 2 arguments.

Place the values in an array, then use Arrays.sort and select the first value (the last value is the highest).

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.