Question:
need help starting this java program?
2010-05-27 06:40:06 UTC
Write a OOP program for your Computer Science teacher that can be used to calculate final grades. The teacher uses the following grade items:
1. five quizzes, each graded out of 10 points
2. a midterm exam graded out of 100 points
3. a final exam, graded out of 100 points

The defining class should contain a constructor with parameters for student’s name, test marks, midterm mark and final exam.

The defining class will have one method to calculate a student’s numeric grade and their final letter grade. Grade items will be weighted as follows:

1. final exam counts for 25% of the final mark
2. midterm counts for 25%
3. five quizzes together count for a total of 50%.

The method should output both the calculated, numeric grade and the final letter grade.

Write a tester class to test your application. Use the constructor to create five students and initialize the instance variables for each student. Invoke the method to calculate the numeric grade and final letter grade for each student. Output each student’s name and show their numeric grade and letter grade.
______________________________________…

now my question is im just not sure where to get started with it, im really having trouble with this course and have just got the constructor concept last night after watch youtube videos lol
Three answers:
Frecklefoot
2010-05-27 07:11:27 UTC
Starting is the hardest part isn't it? Start with the grade class, and don't worry about the Tester program right now:



public class Grader {

private string studentName;

private int[] quizzes; // you can make these floats instead, if you like

private int midtermGrade;

private int finalTestGrade;



private float finalCumlativeGrade;



public Grader( String sName, int[] quizResults, int midtermMark, int finalMark )

{

studentName = sName;

quizzes = new int[5];

System.arraycopy( quizResults, 0, quizzes, 0, 5 );

midtermGrade = midtermMark;

finalTestGrade = finalMark;



calculateGrade();

}



public float getGradeNum() {

return finalCumlativeGrade;

}



public char getGradeLetter() {



// you don't have to calculate it here, you can calculate it as part of

// calculateGrade() and save it another member variable

if( finalCumlativeGrade >= 90.0f )

return 'A';

break;

else if( finalCumlativeGrade >= 80.0f )

return 'B';

break;

// ... you do the rest here

}



private void calculateGrade()

{

// this is the real meat of the class here, use the weights your professor gave you to

// calculate this final mark and store it in finalCumlativeGrade

}

}



Okay, I did more than I intended, but that's a huge leg-up on your assignment. Fill in the empty parts and you're nearly done. All that's left is to make a new Tester class. That is easy. Just declare the new class and give it a Main(). Have the Main declare 5 Grader objects and initialize them (since the constructor takes all the values as params, you'll have to initialize them as you declare them). The rest if just doing what the assignment says. Good luck! HTH
?
2010-05-27 06:54:32 UTC
If you are able to do the initializations in the constructor, then you just need to calculate the grades based on the logic given.

Create Student class and Exam class.
?
2016-10-25 15:23:20 UTC
For a straightforward programmer, you could acquire prevalent jdk1.6. commence writing a software with a classification call very corresponding to the record call. Eg: classification javatest then record call: javatest.java Now complete this methodology and keep. Open MS-DOS (Ctrl-R-->cmd) pass to the route the position you've written this methodology. probably keep this methodology interior the same folder the position javac is kept. then sort "javac filename.java" Eg: javac javatest.java this may assemble your software and allow you to debug your blunders. Now sort "java filename" Eg:java javatest this may execute your software in DOS.


This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Loading...