The aim of this assignment is to make sure that you understand and are familiar with the concepts covered in the lectures, including linked list, pointer operations, and parameter passing mechanisms.
CSE 240 Homework 6Linked Lists
Spring 2016 (50 points)
Due Saturday, February 27, 2016 at 11:59PM, plus a 24-Hour grace period
Introduction
The aim of this assignment is to make sure that you understand and are familiar with the concepts covered in the lectures, including linked list, pointer operations, and parameter passing mechanisms. By the end of the assignment, you should have understood and exercised
- Pointer operations accessing structured data
- Linked list of structures, with complex manipulations of pointer and structure
- Parameter passing and return values of different types.
Reading: Chapter 2, Textbook Section 2.5.4 on linked list and Section 2.6 on parameter passing; Section 2.10 gives a case study on linked list operations.
Preparation: Complete the multiple choice questions in the textbook exercise section. The answer keys can be found in the course Web site. These exercises can help you prepare for your weekly quiz and the exam. You are encourage to read the other exercise questions and make sure you understand these questions in the textbook exercise section, which can help you better understand what materials are expected to understand after the lectures and homework on each chapter.
You are expected to do the majority of the assignment outside the class meetings. Should you need assistance, or have questions about the assignment, please contact the instructor or the TA during their office hours.
You are encouraged to ask and answer questions on the course discussion board. However, do not share your answers and codein the course discussion board.
Programming Assignment (50 points)
You are given a partially completed program hw06.c. Your job is to follow the instructions given in the program to complete the functions so that the program executes properly. A user is given the option to input a new student,delete a student, search for the grade of a student, or determine the class average of the students on the list.A good portion of the code is already implemented for you. The best way to start this assignment would be to start in the main and trace through the helper function and understand how the code works.
Add
When inputting a new student, the user is prompted for the student’s first name, last name, grade in the class (an integer between 0 and 100), and education level. The add() function is worth 15 points and has specific instructions on how the list is to be sorted. For simplicity, in this assignment you are to assume that no students on the list will have the same last name. However, you still should not allow for a student to be added to the list twice. This means that you will only need to check the last names of the students on the list and compare them to the last name of the student being added to determine if the student is already on the list. Please follow these instructions very carefully while writing this function and notice the return type.
Search
When searching for a student’s grade, you will be prompted for the student’s last name. You will use this last name to search for the student on the list and you will be returning a pointer to that student.Please follow these instructions very carefully.
Average
This function simply traverses your linked list and returns the average of all of the students’ grades on the list. Notice that the return type is of type double.
Delete One
When deleting a student from the list, you will be prompted for the student’s last name. You will use this last name to search for the student on the list and remove them. You will need to do so in a way that does not break your linked list and ensures no memory leaks. You will notice that the search function is called before this function, therefore, you are to assume that the student that you are looking for is on the list.Please follow these instructions very carefully.
Grading of Programming Assignment
The TA will grade your program following these steps:
(1) The TA will read your program and give points based on the points allocated to each component, the readability of your code (organization of the code and comments), logic, inclusion of the required functions, and correctness of the implementations of each function.
(2) Compile the code. If it does not compile, 20% of the points given in (1) will be deducted. For example, if you are given 20 points in step (1), your points will become 16 if the program fails to compile.
(3) If the code passes the compilation, the TA will execute and test the code. If, for any reason, the program gives an incorrect output or crashes for any input, 10% of the points given in (1) will be deducted.
What to Submit?
You are required to submit your solution in a compressed format (.zip). Make sure your compressed file is label correctly – lastname_firstname6.zip. (All lowercase, do not put anything else in the name like “hw4”.)
The compressed file MUST contain the following:
hw06.c
No other files should be in the compressed folder.
If multiple submissions are made, the most recent submission will be graded. (Even if the assignment is submitted late.)
Where to Submit?
All submissions must be electronically submitted to the respected homework link in the course web page where you downloaded the assignment.
Late submission deduction policy
- No penalty for late submissions that are received within 24 hours after the deadline;
- 10% grade deduction for every day it is late after the grace period;
- No late submission after Tuesday at 11:59PM.