Announcements
We will have a simple 5 minute quiz at the beginning of the lab on Blackboard. Please sign in to your Blackboard account and finish the quiz individually. To access the quiz, go to CS 141 course on Blackboard, and click on Lab Quizzes, there you can find Lab 13 Quiz. To access the quiz, you will need a password, which will be announced by the TA in the lab
The full version of lab assignment is on Blackboard, under the link "Lab Assignments" > "Lab 13 Programming Activity". To access the assignment, you need a password, which will be announced by the TA in the lab
You must work with a single partner, in a group of 2. You must take turns being the “driver” and the “navigator”. (If there are an odd-number of students in the class, your TA will make an adjustment.)
Bring your laptops to work with the IDE of your choice
Lab Grading Policy
There are 3 questions. The maximum score is 2, where each question is worth 1 point. Question 3 is extra credit. To get a grade, you must demonstrate the assignments to a TA, & submit the work onto Blackboard before your lab session ends. Late submission is not accepted. Once you finish your work, please raise your hand and show your work to the TA during the last 10 minutes of lab or whenever you finish, the earlier of the two.
Lab Activity
This week, we will continue with our practise of using Linked Lists. Additionally, we will revisit some previously taught concepts of structures.
We will be designing & implementing a simple Dating game by playing around with a linked list of structures.
You are provided with a file (attached: CandidateList.txt) having a candidate name list, along with their gender, & travel preference on a scale of 1 to 5. You need to read and store all the information in memory, in a linked list of structures. Allow the user to provide the gender & preference of a candidate for whom a match is required, & your program needs to find the best match for that candidate from the CandidateList.txt. There can be multiple best matches, however, for this lab, finding one or more of the matches will do.
(Credit 1) Create a struct to hold each candidate information.
(Credit 2) Store the input structs into a linked list, prepending each new node to the front of the list. Traverse the linked list and print out the values.
(Extra Credit) Prompt for the gender desired, and your own travel preference. Traverse the linked list. For each node see if it matches the desired gender. If so calculate the difference between your travel preferences and the values for that node. Keep track of the closest match, and print it out at the end.
A helper code for reading from a file is given for reference - (attached: Lab13.cpp). You can use/modify this code for the file reading part.