CS 1401 Assignment #12

Date Assigned: Wednesday, April 13, 2005

Due Date: Wednesday, April 20, 2005, before the beginning of your lab section.

Goals: to learn how to use for looping statements and combined assignment operators.

Points: This assignment is worth a total of 20 points. No late assignments will be accepted, but credit will be given for partially completed assignments turned in on time.

 

Assignment:

Many students like to be able to compute an approximate grade for a course based upon their scores. In this lab you will be designing and coding an application which uses a sample formula to compute a student’s semester grade for CS 1401. NOTE: the formula used to compute the grade follows the percentages listed in the course syllabus, but represents a simplified version which does not include all items. However, it provides an approximation of a semester grade and includes a student’s exams, quizzes, lab assignments, lab attendance, research reports, and final. Specific details are given below.

Create an application class named GradeApp as follows:

        Include in the application class a prompt for the user to enter his/her name, the course number (1401), and the title of the course (Introduction to Computer Science).

        Create a separate file for each category of score. Place one integer score per line. The names for the files and the number of scores each should contain is as follows (notice that in this simplified version, no homework is included):

Lab Assignments (13): labassign.txt

Lab Attendance (28): labattend.txt

Research Reports/Experiments (2): report.txt *Assume both scores are 15

Quizzes (13): quiz.txt

Regular Exams (4): exam.txt

(No file is needed for the final since there is just one grade. The user will be prompted for this value.)

        Use a score of 0 as a place holder for missing grades, so that the total number of items in each file is exactly as shown above. For special cases, such as an excused absence resulting in a missing grade, fill in a dummy number such as the same number as the average of scores that the student does have. (Although not strictly accurate, this will work for the lab).

        Use for looping statements to read in scores for each type of grade, such as quizzes, and sum up the subtotal for each type of grade. Store the sum for each type of grade in a separate variable, and use the combined assignment operator += to sum them.

        Prompt the user to enter a final exam grade (a score between 0 and 100).

        Pass the sums for each type of grade as arguments to a computeGrade method in another class, Course (see details for class below).

        For example, assume a student is named Julia. The computeGrade method computes the semester grade of 85.2. It is okay to show decimals. The application should display the following message as output:

The semester grade for Julia in CS 1401 (Introduction to Computer Science) is approximately: 85.2

 

Create an object-creating class named Course as follows:

        This class is used to create new course objects with two fields, the course number represented as a string (CS 1401) and the course title (Introduction to Computer Science).

        Include appropriate accessor methods for the fields.

        Include a computeGrade method in this class which computes and returns the semester grade for students in the course based upon the correct percentages for each type of grade. For our course, CS 1401, this method has six parameters (5 subtotals for each type of grade, plus a single final exam grade). The formula to use for computing the semester grade within the computeGrade method is a simplified version described as follows:

1)      Multiply the subtotal of regular exams times 0.80 to convert to an 80-point scale (80 points would be a perfect score rather than 100 for any one exam).

2)      Multiply the final exam score times 1.5 to convert to a 150-point scale (150 points would be a perfect score rather than 100 for the final).

3)      Sum up the converted exam subtotal, the converted final exam score, and the subtotals for lab assignments, lab attendance, research reports/experiments, and quizzes. Store the sum in a variable. If all scores were perfect, the value stored in the variable would be 1000.0 at this point.

4)      Divide the sum in the variable by 10 to convert the score back to a 100-point scale. This will be the semester grade returned by the method.

Deliverables: as announced in the labs and explained in the handouts given to you in the labs.