Converting this into GUI?
Okay so im not completely done with this program, but i want to get it working in GUI and then applet before i move on in it, its a grading program that then spits out grades needed for an A for now, whats the easiest way to convert this into GUI, ive really only used joptionpane and not really all that much looking for any and all help maybe if someone could convert one section of it for me would be amazing as well where i could look at it for how to do the rest!
And for example the last part from "For an A in this class you will need the following grades: through all of the assignments id like all of that on one panel! Ive got this program to work but gah am i horrible at GUI
Thanks!
Code java:
import java.util.Scanner;
public class Prog5 {
public static void main(String args[])
{
int numberOfGrades;
int grade = 0;
int gradesDone = 0;
int completed;
float totalPoints = 0;
int points;
float pointsEarned = 0;
float remainingPoints;
int aLeft;
float assignment = 0;
int aCounter = 0;
Scanner input = new Scanner( System.in );
System.out.println("How many total grades will there be? ");
numberOfGrades = input.nextInt();
int [] grades = new int [numberOfGrades+1];
do
{
grade++;
System.out.println("Points possible for assignment " + grade + ":");
grades[grade] = input.nextInt();
}while (grade < numberOfGrades);
for ( int counter=1; counter < grades.length; counter++ )
totalPoints += grades[counter];
System.out.println("an ID "+ java.util.Arrays.toString(grades));
System.out.println(totalPoints);
System.out.println("How many assignments completed?");
completed = input.nextInt();
int [] completedArray = new int [completed+1];
do
{
gradesDone++;
System.out.println("Points recieved on assignment " + gradesDone + ":");
completedArray[gradesDone] = input.nextInt();
}while (gradesDone < completed);
for ( int counter=1; counter < completedArray.length; counter++ )
pointsEarned += completedArray[counter];
remainingPoints = (totalPoints - pointsEarned);
aLeft = numberOfGrades - completed;
do
{
assignment++;
}while (((pointsEarned+assignment)/(totalPoints)) <= .895);
System.out.println("For an A in this class you will need the following grades:");
do
{
aCounter++;
if ((assignment-grades[gradesDone+aCounter])>0)
{
System.out.println("Assignment " + (gradesDone+aCounter) + ": " +
(int) (grades[gradesDone+aCounter]));
assignment = assignment-grades[gradesDone+aCounter];
}
else
{
System.out.println("Assignment " + (gradesDone+aCounter) + ": " + (int) assignment);
assignment = assignment-grades[gradesDone+aCounter];
}
}while (assignment > 0);
}
}
Re: Converting this into GUI?
First off, get all of that code out of the main method and instead create a proper class with instance fields and methods. Until you do that, you'll not be able to make a GUI out of any of this.