CS 105 FINAL PROJECT

profileRamis808
cs105_project4.pdf

1

Project 4 CS 105 Summer 2016

Objectives:

1. Gain an understanding of how to implement and use functions.

2. Gain an understanding of scope. 3. Learn to use CheckBoxes.

4. Learn to format the Double data type values as percentage. 5. Learn to write to file. 6. Learn to read from a file.

7. Learn to use the Visible property of objects on the form.

DUE DATE:

THURSDAY, JULY 21, AT THE BEGINNING OF CLASS.

PROBLEM TO SOLVE:

During the quarter, CS105 students would like to know what grade they would receive based on all assignments and exams that have so far been submitted and graded. Design a program that permits the user to select which assignments and exams have been

submitted, and to enter the scores received on these. The program should then display the grade based on these, as both a percentage value and a letter grade. After the grade has

been calculated, write the information to file; using a MessageBox, inform the user that the information has been written to file. Finally, allow the user to read the contents of the file that has been written.

The program must use CheckBoxes to allow the user to select which assignments and exams have been graded.

In order to get full credit on this project, you must implement the following two

functions:

The program must implement a function procedure to return the numerical grade (i.e.

percentage grade) based on the currently graded assignments and exams.

The program must also implement a function to convert the percentage grade to the

corresponding letter grade.

Make a Project4 folder in your CS account.

Create a new project and name it GradeCalculator. Save it inside the Project4 folder.

Rename the source code file GradeCalculator.vb.

Here are a few hints to help you get started:

1. Pages 195 - 197 in your text provides information on how to implement and use

functions; also refer to your solutions for Labs 9 and 10.

2

2. Pages 169 - 170 in your text provides information on how to use the CheckBox control. Pay especial attention on how to utilize the Checked property of the

CheckBox. You may also refer to your solution for Lab10. 3. Page 172 of your text describes how to use message dialogs.

4. Set to zero the default Text property of the TextBoxes used for user input. 5. If both the click event and a function require access to constants or variables,

these need to be declared with class scope. Pages 203 – 206 in your text explain

the concept of scope. 6. Item #4 at the top of page 470 and the middle paragraph page 504 describe how to

use the Visible property of a control on the form. 7. To assist you in solving this problem, refer to your solution for Lab10. 8. To display the contents of the file, use a Multiline = True, ReadOnly = True

TextBox, with the ScrollBars property set to Both. 9. The syntax for formatting a double value to a percentage is:

numGradeTxt.Text = String.Format(“{0:P} ”, numericalGrade) For example, if the value stored in numericalGrade is 0.9454, the following would be displayed in numGradeTxt:

94.54% 10. The following weighted values for each assignment can be found on the CS105

Syllabus web site.

3

11. Use the following grading scale cutoff values to convert the numerical grade to a letter grade.

A: 94.0%

A-: 90.0%

B+: 87.0%

B: 83.0%

B-: 80.0%

C+: 77.0%

C: 73.0%

C-: 70.0%

D+: 67.0%

D: 63.0%

D-: 60.0%

F: < 60.0%

For example, a numerical grade of 94.0% would convert to an A; 93.9% would convert to an A-; 77.0% would be a C+, etc.

12. Study the Sample Output images below to understand the way to set up the form and the sequence of events that should be followed.

Sample Output:

Step 1: Select assignments and enter grades.

4

Step 2: Click the Calculate Grade button to display cumulative grade of these assignments. Note that the Write Grades To File button is now visible.

Step 3: Click the Write Grades To File button, which generates a MessageBox to inform

the user that information has been written to file. Click the OK button of the MessageBox.

5

Step 4: Click the Read Grades From File button

Step 5: The contents of the file are displayed; both the Write Grade To File Button and the Read Grades From File button are now no longer visible.