any help would be appreciated.this is what i have
import javax.swing.JOptionPane;
public class proj22
{
public static void main(String args[])
{
}
static int credits, semester, grades, GPA;
static String creditsValue, semesterValue, courseName;
public static void PrintExplanation(){
//This explains what the program is for to the person who is running it.
JOptionPane.showMessageDialog(null, "This allows you to calculate your GPA for the semster you are/were in by entering the number/letter of your grades).");
}
public static int GetValidNumberInput(String promptStr, int lowerNum, int upperNum){
//This gets the course grade and restricts it to within regular GPA limits
semesterValue = JOptionPane.showInputDialog("What are/were semester are you in?");
semester = Integer.parseInt(semesterValue);
do
{
courseName = JOptionPane.showInputDialog("What is the course name? \n or type 'end' if no courses left");
if
(courseName.equals("end"))
break;
System.out.println("showInputDialog: "+ courseName);
String grade = JOptionPane.showInputDialog("What did you make in this class?");
System.out.println( "showInputDialog: "+ grade);
creditsValue = JOptionPane.showInputDialog("How many hours was this class?");
if
(credits < lowerNum || credits > upperNum){
JOptionPane.showMessageDialog(null, "That is not a valid number.");
}
else
{
credits += Integer.parseInt(creditsValue);
}
}
while (!courseName.equals("end"));
return
credits;
}
public static void GenerateGPAReport ( int totalCredits, int totalQualityPoints){
//This shows what the GPA is
JOptionPane.showMessageDialog(null,"Grading Period:"+semester+ "\n Total Credits Taken :"+totalCredits+ "\n Total Quality Points:"+totalQualityPoints+"\n GPA:"+GPA);
}
public static int CalculateGPA (int totalCredits, int totalQualityPoints){
//Calculates the GPA
totalQualityPoints = credits * grades;
GPA = totalQualityPoints / totalCredits;
return GPA;
}
public static int ConvertGradeToPoints(String grade){
//This converts their letter grade to a GPA number grade(i.e. A = 4, B=3, C=2, ect)
if (grade.equalsIgnoreCase("A")){ grades = 4;
}
else
if
(grade.equalsIgnoreCase("B")){
grades = 3;
}
else
if
(grade.equalsIgnoreCase("C")) { grades = 2;
}
else
if
(grade.equalsIgnoreCase("D")){
grades = 1;
}
else
{
grades = 0;
}
return
grades;
}
}

New Topic/Question
Reply



MultiQuote






|