Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Lists in Action CODE THAT DOES NOT COMPILE WILL RECEIVE A GRADE of 0. You may comment out the code fragments that cause you code
Lists in Action CODE THAT DOES NOT COMPILE WILL RECEIVE A GRADE of 0. You may comment out the code fragments that cause you code to no compile (or crash). Your assignment grade will correspond to the parts of your code that actually work. Implement your own Student data type. Your data type must have at least 4 attributes (data members). The data type must include a getter method and a setter method for each attribute. student_id (int) # The ID number of the student student_name (str) # The name of the student student_balance (float) # The balance on the student account >=0 next (Student) # Reference to the next student object in the list Implement your own linked list type. Call it Roster. Each object in your linked list type must be of the above Student type. Implement algorithms (as methods in your Roster class) that perform the following operations on the Roster. def add_student(s): # Add the student s to the list of students #Parameter # s (Student): a reference to an object of type Student #Returns # None def pay_tuition(i, amt): # Reduces the balance of student i by amount #Parameters # i (int): The index of the student whose balance is to be reduced # amt (float): The amount by which this student's balance is to be reduced #Returns # None def show(): # Print the current list of students def clear(): # Remove all the students whose balance is 0.0 Develop a main function that provides the user with a menu and lets the user choose what operations they want to perform on the roster. A sample run of your main() function might look as follows: (The sections in red are user keyboard input) Welcome to Roster! Here are the students ID Name Balance 08 Bobby 523.12 05 Jane 15.60 13 Joe 1002.03 (1) to add a student (2) to pay tuition (3) to clear (4) to exit Your choice: 1 ID: 17 Name: Alice Balance: 100.50 Student added! =========================== Welcome to Roster! Here are the students ID Name Balance 08 Bobby 523.12 05 Jane 15.60 13 Joe 1002.03 17 Alice 100.50 (1) to add a student (2) to pay tuition (3) to clear (4) to exit Your choice: 2 Index: 1 Amount: 10.00 Student updated! =========================== Welcome to Roster! Here are the students ID Name Balance 08 Bobby 523.12 05 Jane 5.60 13 Joe 1002.03 17 Alice 100.50 (1) to add a student (2) to pay tuition (3) to clear (4) to exit Your choice: 2 Index: 1 Amount: 5.60 Student updated! =========================== Welcome to Roster! Here are the students ID Name Balance 08 Bobby 523.12 05 Jane 0.00 13 Joe 1002.03 17 Alice 100.50 (1) to add a student (2) to pay tuition (3) to clear (4) to exit Your choice: 3 Students with $0 balance cleared! =========================== Welcome to Roster! Here are the students ID Name Balance 08 Bobby 523.12 13 Joe 1002.03 17 Alice 100.50 (1) to add a student (2) to pay tuition (3) to clear (4) to exit Your choice: 4 See you later
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started