First off...THANK YOU!! I need some direction on how to set up a "yes" or "no" question and if its a "yes" answer...will go into a while loop to enter 3 scores..
I need the question to say....."Would you like to enter test scores?" I am going to paste my code so you can view it.
THIS IS WHAT I NEED THIS PROGRAM TO DO PLEASE.......(Ask if they want to enter scores? If yes go into the loop then ask for score1, then score 2, finally score3. Then calc average and display results. Then ask again if they want to enter another score).
import javax.swing.JOptionPane;
public class whileAssignment
{
public static void main (String [] args)
{
//declare variables
String strScore1, strScore2,strScore3;
int score1, score2, score3, average;
//get user input
THIS IS WHERE I NEED THE YES OR NO TO DICTATE WHETHER OR NOT I GO INTO THE LOOP....
//open the while loop
while(score1 != 74)
{
strScore1 = JOptionPane.showInputDialog("Would you like to enter score 1 again?");
score1 = Integer.parseInt(strScore1);
//close the loop
}
strScore2 = JOptionPane.showInputDialog("Would you like to enter score 2?");
score2 = Integer.parseInt(strScore2);
//open the while loop
while(score2 != 83)
{
strScore2 = JOptionPane.showInputDialog("Would you like to enter score 2 again?");
score2 = Integer.parseInt(strScore2);
//close the loop
}
strScore3 = JOptionPane.showInputDialog("Would you like to enter score 3?");
score3 = Integer.parseInt(strScore3);
//open the while loop
while(score3 != 91)
{
strScore3 = JOptionPane.showInputDialog("Would you like to enter score 3 again?");
score3 = Integer.parseInt(strScore3);
//close the loop
}
average = (score1 + score2 +score3) / 3;
JOptionPane.showMessageDialog(null, "The average of all 3 scores is: " + average);
}
}
i APPRECIATE ANY HELP AND GUIDANCE...THANK YOU!!