Olá pessoal, tenho um aplicativo que desnvolvi no netbeans.
import java.text.DecimalFormat;
import javax.swing.JOptionPane;
public class MediaTeste2 {
public static void main ( String args [] )
{
int gradeCounter,
gradeValue,
total;
double average;
String input;
total = 0;
gradeCounter = 0;
JOptionPane.showMessageDialog(null,
"Valor maximo de nota é 100", " Informativo ", JOptionPane.INFORMATION_MESSAGE);
input = JOptionPane.showInputDialog(null,
"Coloque a nota\nPara finalizar digite -1", " Insira a Nota ", JOptionPane.PLAIN_MESSAGE);
gradeValue = Integer.parseInt( input );
if ( gradeValue > 100 ) {
JOptionPane.showMessageDialog(null,
"Valor Invalido");
return;
}
while ( gradeValue != -1 ) {
total = total + gradeValue;
gradeCounter = gradeCounter + 1;
input = JOptionPane.showInputDialog(null,
"Coloque a nota\nPara finalizar digite -1", " Insira a Nota", JOptionPane.PLAIN_MESSAGE);
gradeValue = Integer.parseInt( input );
}
DecimalFormat twoDigits = new DecimalFormat( "0.00" );
if ( gradeCounter != 0 ) {
average = (double) total / gradeCounter;
JOptionPane.showMessageDialog( null,
"Média da classe é " + twoDigits.format( average ),
"Média da Classe", JOptionPane.INFORMATION_MESSAGE );
}
else
JOptionPane.showMessageDialog( null,
"Notas não digitadas", "Média da Classe",
JOptionPane.INFORMATION_MESSAGE );
System.exit( 0 );
}
}
while ( gradeValue != -1 ) {^
Alguem poderia me ajudar ?
