No main method/main method not being accepted.
Write a Java program that does the following:
1.Creates a grading program based on the Baker College grading standard. You will need to look up the current grade standard. You may use only the letter grades without the +/- signs.
A = 93-100 etc.
2. Uses a char array to hold the letter grades.
3. Creates a Grade class with private grade attributes and two class methods to manipulate grades. One method will raise their grade point total by 10 points and one method will lower their grade by 15 points. Create 2 instances, ‘Bill’ and ‘Susan’ of the grade class.
4. Creates appropriate display methods for the Grade class.
5. Your program will first print out the Baker grade standard and Bill and Susan’s current letter grade (your choice). The program will then call the methods that will increase and decrease both bill and susan’s point grades and then print their corresponding letter grades. Please notify me in your output, that is, you may want to say: “Bill failed his math final and his final grade dropped to x-points and a letter grade of C.”
6. You must use a Switch construct.
Your output should be as follows:
A. Print the entire Baker College grade standard
B. Bill and Susan’s current grade point total and equivalent letter grades
C. Bill and Susan’s current grade point total and equivalent letter grades after raising the grade by 10 points.
D. Bill and Susan’s current grade point total and equivalent letter grades after lowering the grade by 15 points.
This is what I have so far. I cannot get a main method to work. Using Netbeans. I have tried public static void main(String[] args) but I get an error and when I try to compile and run it spits back a lot of errors. I thought I was on the right track but apparently not. Any input would be great.
public class Grades
{
private char [ ] letterGrade = {'A', 'B', 'C', 'D', 'F'}
private int numberGrade;
private char grade;
public void setGrade(int percent)
{
if(percent <=100 && percent >=90)
{
numberGrade = percent;
grade = (char)letterGrade[0];
}
if(percent <=89 && percent >=80)
{ numberGrade = percent;
grade = (char)letterGrade[1];
}
if(percent <=79 && percent >=70)
{
numberGrade = percent;
grade = (char)letterGrade[2];
}
if(percent <=69 && percent >=60
numberGrade = percent;
grade = (char)letterGrade[3];
}
if(percent <=59 && percent >=0)
{
numGrade = percent;
grade = (char)letterGrade[4];
}
}
}
public char getLetterGrade()
{
return grade;
}
public int getNumberGrade()
{
return numberGrade;
}
public void raiseGrade()
{
numberGrade = numberGrade + 10;
setGrade(numberGrade);
numberGrade
}
public void lowerGrade()
{
numberGrade = numberGrade - 15;
setGrade(numberGrade);
numberGrade
}
public void displayAllGrades()
{
System.out.println("100 - 90 = " + letterGrade[0]);
System.out.println("89 - 80 = " + letterGrade[1]);
System.out.println("79 - 70 = " + letterGrade[2]);
System.out.println("69 - 60 = " + letterGrade[3]);
System.out.println("59 - 0 = " + letterGrade[4]);
}
public void students (char student)
{
switch(student)
{
case 'D': // D for default. Prints the Baker College Grading Rubric
System.out.println("Baker College Grading Rubric:\n");
displayAllGrades();
break;
case 'B': // B for Bill
setGrade(89);
numberGrade = getNumberGrade();
grade = getLetterGrade();
System.out.println("\nBill started with " + numberGrade + " points and a grade of " + grade + " in his Java class.");
raiseGrade();
numberGrade = getNumberGrade();
grade = getLetterGrade();
System.out.println("Bill aced his quiz and his grade rose to " + , numberGrade + " points and a grade of " + grade + " in his Java class.");
lowerGrade();
numberGrade = getNumberGrade();
grade = getLetterGrade();
System.out.println("Bill did not do so well on his project and his grae dropped to " + numberGrade + " points and a final grade of " + grade + " in his Java class.");
break;
case 'S': // S for Susan
setGrade(92);
numberGrade = getNumberGrade();
grade = getLetterGrade();
System.out.println("\nSusan started with " + numberGrade + " points and a grade of " + grade + " in her Java class.");
lowerGrade();
numberGrade = getNumberGrade();
grade = getLetterGrade();
System.out.println("Susan failed her quiz and her grade dropped to " + numberGrade + " points and a grade of " + grade + " in her Java class.");
raiseGrade();
numberGrade = getNumberGrade();
grade = getLetterGrade();
System.out.println("Susan did excellent on her project and her grade has risen to " + numberGrade + " points and a final grade of " + grade + " in her Java class.\n");
break;
} // End of switch construct
} // End of students method
}
|