Description
Computer Programming for Engineering Applications
Extra Credit: Exam # 2
Conventions: Name your C programs as extracredit px.c, where x is the problem number for the extra credit as-
signment. This assignment will credit your exam #2 grade with a maximum of 10 points. Write comments to your
programs. Programs with no comments will receive PARTIAL credit. At each program you turn in at least the
following info should be included
– Author: – Date created: – Brief (two-line) description of the program:
Submission Instructions: Use the dropbox on D2L to submit only the .c files.
Problem 1: Calculate your grade (5 points)
Write a C program to calculate student grades in this class. Your code must use a structure named student info. The
structure must have the following fields (at least).
Student Name: A character array for the student’s name; 100 elements is fine (i.e. no need for dynamic
allocation).
Zyante Participation: A dynamically allocated array for n Zybooks entries. Ask the user how many entries
are to be entered.
Homework Assignments: Dynamically allocate memory for m entries. Ask the user how many entries are to
be entered.
- Midterm1: An integer, points earned on exam 1.
- Midterm2: An integer, points earned on exam 2.
- Final Project: An integer containing the points earned on the project.
- Grade Print: A float showing the percentage calculated.
- Letter Grade: A chart showing the letter grade.
Your C program must
- Prompt the user to enter in the number of students in the class.
- Dynamically allocate memory for the appropriate number of students.
- Prompt the user to enter in the number of Zybooks entries.
- Dynamically allocate memory for the appropriate number of Zybooks entries.
- Prompt the user to enter in the number of homework scores.
- Dynamically allocate memory for the appropriate number of homework entries.
- Ask the user to enter information for each student:
– Name
– Scores for each Zyante participation, homework, midterm, and final project.
- Calculate grade percent and letter grade.
- Display all information for each student.
For this portion of the homework, you do not need to use linked lists. Using an array of type student info is perfectly
acceptable.
1
Sample Code Execution: Red text indicates information entered by the user
Enter in the number of students in the course: 3
Enter the number of homework assignments: 5
Enter in the number of Zybooks assignments: 4
Enter in the name of student number 1: Adam
Enter 4 Zybooks scores (out of 10): 10 10 9 8
Enter 5 homework scores (out of 100): 90 95 90 85 90
Enter midterm 1 (out of 100): 95
Enter midterm 2 (out of 100): 90
Enter the final project (out of 100): 95
Enter in the name of student number 2: Bill
Enter 4 Zybooks scores (out of 10): 9 8 8 8
Enter 5 homework scores (out of 100): 90 90 80 86 87
Enter midterm 1 (out of 100): 76
Enter midterm 2 (out of 100): 85
Enter the final project (out of 100): 85
Enter in the name of student number 3: Sally
Enter 4 Zybooks scores (out of 10): 9 9 8 8
Enter 5 homework scores (out of 100): 80 85 85 90 90
Enter midterm 1(out of 100): 95
Enter midterm 2(out of 100): 95
Enter the final project (out of 100): 80
Which student’s info would you like to display (1-3): 3
Grade information for Sally
Zybooks Scores = [9, 9, 8, 8]
Homework Scores = [80, 85, 85, 90, 90]
Midterm Scores = [95, 95]
Final Project Score = 80
Calculated Percentage = 88.00
Final Grade = B
Would you like to print out the information about another student (y/n)? y
Which student’s info would you like to display (1-3): 2
Grade information for Bill
Zybooks Scores = [9, 8, 8, 8]
Homework Scores = [90, 90, 80, 86, 87]
Midterm Scores = [76, 85]
Final Project Score = 85
Calculated Percentage = 83.35
Final Grade = B
Would you like to print out the information of another student (y/n)? n