Hello anyone,
I am currently in need of some help with the code for one of my methods.
I have 3 inputs for 3 separate quiz scores. My method must choose the highest from these 3 no matter what the input for them was.
The program as a whole is compiling and running but seems to choose one of the 3 inputs at random to pick as the highest.
the code currently looks like this:
// Beginning of method
public void highestquiz () {
if (quizScore1 > quizScore2) {
highestScore = quizScore1;
}
else if (quizScore1 > quizScore3){
highestScore = quizScore1;
}
if (quizScore2 > quizScore1) {
highestScore = quizScore2;
}
else if (quizScore2 > quizScore3){
highestScore = quizScore2;
}
if (quizScore3 > quizScore1) {
highestScore = quizScore3;
}
else if (quizScore3 > quizScore2) {
highestScore = quizScore3;
}
} //end highestscore
I realize that this is probably a very tedious and inefficient way to perform this.
Thank you for any help with my code!