I am new to Java and I am trying to code a "Grading" system. Basically, when the code is ran, a window opens, it asks a question, you enter a number value, press enter, it loads another question, same process as before, hit enter, and repeat for the final time. At the end it takes those 3 numbers, does math and then displays a message. I have the basic code, I am just having issues with the popup window.
public class PopUp {
public static void main(String[] args) {
// Constant grade worth percentage
final int examWeight = 55;
final int hwWeight = 20;
final int activityWeight = 25;
// Current grades
double examGrade = 65.8;
double hwGrade = 55.3;
double activityGrade = 29.5;
double finalGrade;
// Math to figuring out final grade.
examGrade = examGrade * (examWeight / 100.0);
hwGrade = hwGrade * (hwWeight / 100.0);
activityGrade = activityGrade * (activityWeight / 100.0);
finalGrade = examGrade + activityGrade + hwGrade;
//round thingy
double rounded = Math.round(finalGrade *10)/10.0;
// What you made
if (rounded>=90.0 && rounded<100.0) {
System.out.println("You made an A");
}
if (rounded>=85.0 && rounded<92.9) {
System.out.println("You made a B");
}
if (rounded>=75.0 && rounded<84.9) {
System.out.println("You made a C");
}
if (rounded>=67.0 && rounded<74.9) {
System.out.println("You made a D");
}
if (rounded<=59.9) {
System.out.println("You are a fucking failure");
}
System.out.println("Your final grade is: " + rounded);
}
}
I need THAT code to display the information like this in a NEW WINDOW:
So basically:
Question one: 98.8 ENTER
Question two: 76.9 ENTER
Question three: 87.6 ENTER
Result: 93.3 END
In BlueJ the result I am trying to replicate in Eclipse is as follows:
// Ask student to input scores for exam, lab and nomework
IO.output("Enter your exam grade: ");
examScore = IO.inputDouble( );
IO.output("Enter your lab grade: ");
labScore = IO.inputDouble( );
IO.output("Enter your homework grade: ");
hwScore = IO.inputDouble( );
Then the very end would be
// Output the final grade
IO.outputln("Your final grade is " + finalGrade);
http://prntscr.com/9hicp6 -- Proof that it is a new window.