import java.io.*;
import javax.swing.*;
class GS
{
static public void main(String[]args) throws Exception{
double q, q1, q2, q3, q4, q5, q6, q7, q8, q9, q10, q11, x, x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, quotient, quotient1, quotient2, quotient3, quotient4, quotient5, sum, sum1, sum3;
System.out.println("PRELIM LEC");
{
try{
String r = JOptionPane.showInputDialog("Enter PQ1: ");
q = Integer.parseInt(r);
String r1 = JOptionPane.showInputDialog("Enter PQ2: ");
q1 = Integer.parseInt(r1);
String r2 = JOptionPane.showInputDialog("Enter PCS: ");
q2 = Integer.parseInt(r2);
String r3 = JOptionPane.showInputDialog("Enter EXAM: ");
q3 = Integer.parseInt(r3);
quotient = (q*0.20) + (q1*0.20) + (q2*0.10) + (q3*0.50);
System.out.println(" ");
System.out.println("PLEC : "+quotient);
System.out.println(" ");
System.out.println(" ");
System.out.println(" ");
System.out.println("MIDTERM LEC");
String r4 = JOptionPane.showInputDialog("Enter MQ1: ");
q4 = Integer.parseInt(r4);
String r5 = JOptionPane.showInputDialog("Enter MQ2: ");
q5 = Integer.parseInt(r5);
String r6 = JOptionPane.showInputDialog("Enter MCS: ");
q6 = Integer.parseInt(r6);
String r7 = JOptionPane.showInputDialog("Enter EXAM: ");
q7 = Integer.parseInt(r7);
quotient1 = (q4*0.20) + (q5*0.20) + (q6*0.10) + (q7*0.50);
System.out.println(" ");
System.out.println("MLEC : " +quotient1);
System.out.println(" ");
System.out.println(" ");
System.out.println(" ");
System.out.println("FINALS LEC");
String r8 = JOptionPane.showInputDialog("Enter FQ1: ");
q8 = Integer.parseInt(r8);
String r9 = JOptionPane.showInputDialog("Enter FQ2: ");
q9 = Integer.parseInt(r9);
String r10 = JOptionPane.showInputDialog("Enter FCS: ");
q10 = Integer.parseInt(r10);
String r11 = JOptionPane.showInputDialog("Enter EXAM: ");
q11 = Integer.parseInt(r11);
quotient2 = (q8*0.20) + (q9*0.20) + (q10*0.10) + (q11*0.50);
System.out.println(" ");
System.out.println("FLEC : " +quotient2);
System.out.println(" ");
System.out.println(" ");
System.out.println(" ");
System.out.println("LECTURE GRADE : "+((quotient + quotient1+ quotient2)/3));
System.out.println(" ");
System.out.println(" ");
System.out.println(" ");
System.out.println(" ");
System.out.println(" ");
System.out.println("PRELIM LAB");
String c = JOptionPane.showInputDialog("Enter PMP1: ");
x = Integer.parseInt(c);
String c1 = JOptionPane.showInputDialog("Enter PMP2: ");
x1 = Integer.parseInt(c1);
String c2 = JOptionPane.showInputDialog("Enter PCS: ");
x2 = Integer.parseInt(c2);
String c3 = JOptionPane.showInputDialog("Enter EXAM: ");
x3 = Integer.parseInt(c3);
quotient3 = (x*0.20) + (x1*0.20) + (x2*0.10) + (x3*0.50);
System.out.println(" ");
System.out.println("PLEC : "+quotient3);
System.out.println(" ");
System.out.println(" ");
System.out.println(" ");
System.out.println("MIDTERM LAB");
String c4 = JOptionPane.showInputDialog("Enter MMP1: ");
x4 = Integer.parseInt(c4);
String c5 = JOptionPane.showInputDialog("Enter MMP2: ");
x5 = Integer.parseInt(c5);
String c6 = JOptionPane.showInputDialog("Enter MCS: ");
x6 = Integer.parseInt(c6);
String c7 = JOptionPane.showInputDialog("Enter EXAM: ");
x7 = Integer.parseInt(c7);
quotient4 = (x4*0.20) + (x5*0.20) + (x6*0.10) + (x7*0.50);
System.out.println(" ");
System.out.println("MLEC : " +quotient4);
System.out.println(" ");
System.out.println(" ");
System.out.println(" ");
System.out.println("FINALS LAB");
String c8 = JOptionPane.showInputDialog("Enter FMP1: ");
x8 = Integer.parseInt(c8);
String c9 = JOptionPane.showInputDialog("Enter FMP2: ");
x9 = Integer.parseInt(c9);
String c10 = JOptionPane.showInputDialog("Enter FCS: ");
x10 = Integer.parseInt(c10);
String c11 = JOptionPane.showInputDialog("Enter EXAM: ");
x11 = Integer.parseInt(c11);
quotient5 = (x8*0.20) + (x9*0.20) + (x10*0.10) + (x11*0.50);
System.out.println(" ");
System.out.println("FLAB : " +quotient5);
System.out.println(" ");
System.out.println(" ");
System.out.println(" ");
System.out.println(" ");
System.out.println("LAB GRADE : "+((quotient3 + quotient4+ quotient5)/3));
System.out.println(" ");
System.out.println(" ");
JOptionPane.showMessageDialog(null, "OVER ALL GRADE : " + ((quotient*0.30) + (quotient1*0.30) + (quotient2*0.40)) + ((quotient3*0.30) + (quotient4*0.30) + (quotient5*0.40)));
System.out.println("Thank You for using my program");
System.out.println("Copyright 2009");
System.out.println("version....");
JOptionPane.showInputDialog("Would you like to try again? Y/N");
} catch(Exception R){
JOptionPane.showMessageDialog(null, "Invalid input, Program accepts integers only" +R);
System.out.println("Thank you for using my Program");
System.out.println("Copyright 2009");
System.out.println("version...");
}
}
}
}
thanks guyz im new to programming and i need a little help. As you can see this is just a grading system which my professor made too complicated for me T_T. I don't know what to input. My professor asks me to how to repeat the program after I inputed all the grades (or to try again the grading system). I don't know what to input..And another, if I mistyped a letter rather than a number, the message must show just to input again the number instead of starting all over again...HOW!!!! PLEASE HELP ME GUYzz THANKS!!