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!
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);
}
}

New Topic/Question
Reply



MultiQuote




|