ECE 175: Computer Programming for Engineering Applications
Extra Credit: Exam # 2
Due Date: Friday, December 2, 2016 5:00 PM via the D2L Dropbox
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 Prcnt : A float showing the percentage calculated.
• Letter Grade : A char 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 in 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 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 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 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 of 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
2
Problem 2: Linked List with Node Removal (5 points)
The file ClassData10.txt contains grade information for 10 fictitious students. The file format is
• Student Name
• 12 Reading Assignment Scores
• 8 Homework Scores
• Scores for midterm 1, midterm 2, and the final project Using a linked list, write a C program that
1. Reads the file information into a linked list.
2. Calculates and displays the final grades for all 10 students.
3. Prompts the user to see which student dropped the course.
4. Repeats 2 and 3 until the user decides to terminate, or there are no students left in the class.
Sample Code Execution: Red text indicates information entered by the user
There are 10 Students in the class
Student # 1 is Sarah Tmp: Final Grade: A Student # 2 is Jennifer Tmp: Final Grade: B Student # 3 is Joshua Tmp: Final Grade: B Student # 4 is Natalie Tmp: Final Grade: B Student # 5 is Scott Tmp: Final Grade: B Student # 6 is David Tmp: Final Grade: B Student # 7 is Megan Tmp: Final Grade: B Student # 8 is Emily Tmp: Final Grade: B Student # 9 is Sydney Tmp: Final Grade: B Student # 10 is Lily Tmp: Final Grade: A
Would you like to drop a student (y/n)? y Which student would you like to drop? 1 There are 9 Students in the class
Student # 1 is Jennifer Tmp: Final Grade: B Student # 2 is Joshua Tmp: Final Grade: B Student # 3 is Natalie Tmp: Final Grade: B Student # 4 is Scott Tmp: Final Grade: B Student # 5 is David Tmp: Final Grade: B Student # 6 is Megan Tmp: Final Grade: B Student # 7 is Emily Tmp: Final Grade: B Student # 8 is Sydney Tmp: Final Grade: B Student # 9 is Lily Tmp: Final Grade: A
Would you like to drop a student (y/n)? y Which student would you like to drop? 9 There are 8 Students in the class
Student # 1 is Jennifer Tmp: Final Grade: B Student # 2 is Joshua Tmp: Final Grade: B Student # 3 is Natalie Tmp: Final Grade: B Student # 4 is Scott Tmp: Final Grade: B Student # 5 is David Tmp: Final Grade: B Student # 6 is Megan Tmp: Final Grade: B Student # 7 is Emily Tmp: Final Grade: B Student # 8 is Sydney Tmp: Final Grade: B
Would you like to drop a student (y/n)? y Which student would you like to drop? 4 There are 7 Students in the class
Student # 1 is Jennifer Tmp: Final Grade: B Student # 2 is Joshua Tmp: Final Grade: B Student # 3 is Natalie Tmp: Final Grade: B Student # 4 is David Tmp: Final Grade: B Student # 5 is Megan Tmp: Final Grade: B Student # 6 is Emily Tmp: Final Grade: B Student # 7 is Sydney Tmp: Final Grade: B
Would you like to drop a student (y/n)? n
3