Write the code to maintain a list of student records. The main flow of your program should be to read all information from file(s) and place it in arrays, loop and do stuff with the records (e.g., add, update, look up, etc.), before exiting optionally write the new information back to the file(s) before exiting. Please note the files are only accessed at the beginning and the end, do not change the files during the “do stuff loop” (unless you have a “save changes” option in the loop) Example Below:

class Student:
def __init__(self, name, address, ID, phone_numbers, courses_completed):
self.name = name
self.address = address
self.ID = ID
self.phone_numbers = phone_numbers
self.courses_completed = courses_completed

def __str__(self):
return f”Name: {self.name}\nID: {self.ID}\nAddress: {self.address}\nPhone Numbers: {‘, ‘.join(self.phone_numbers)}\nCourses Completed: {‘, ‘.join(self.courses_completed)}”

class StudentRecords:
def __init__(self):
self.students = []

def add_student(self, student):
self.students.append(student)

def update_student(self, ID, updated_student):
for i in range(len(self.students)):
if self.students[i].ID == ID:
self.students[i] = updated_student
break

def lookup_student(self, ID):
for student in self.students:
if student.ID == ID:
return student
return None

def save_records_to_file(self, file_name):
with open(file_name, “w”) as file:
for student in self.students:
file.write(f”{student.name},{student.address},{student.ID},{‘;’.join(student.phone_numbers)},{‘;’.join(student.courses_completed)}\n”)

def read_records_from_file(self, file_name):
with open(file_name, “r”) as file:
for line in file:
data = line.strip().split(“,”)
name = data[0]
address = data[1]
ID = int(data[2])
phone_numbers = data[3].split(“;”)
courses_completed = data[4].split(“;”)
student = Student(name, address, ID, phone_numbers, courses_completed)
self.students.append(student)

# Example usage:
records = StudentRecords()
records.read_records_from_file(“student_records.txt”)

# Add a student
new_student = Student(“John Doe”, “123 Main St, City, State”, 1234567, [“216-687-2000”], [“Math”, “Science”])
records.add_student(new_student)

# Update a student
updated_student = Student(“John Doe”, “456 Oak St, City, State”, 1234567, [“216-987-6543”], [“Math”, “Science”])
records.update_student(1234567, updated_student)

# Lookup a student
found_student = records.lookup_student(1234567)
if found_student:
print(found_student)
else:
print(“Student not found.”)

# Save records to file
records.save_records_to_file(“student_records.txt”)

A student record will consist of a name, address, ID (7 digits and ID > 1000000), list of phone numbers, and a list of courses completed.

A name object will have 3 parts, first, middle, and last. These three name parts are restricted to only a-z and A-Z characters. You may optionally add additional fields

An address will consist of street number, street name, city, state (2 characters) and zip code. Zip codes will be stored as long (not strings). Zip plus 4 is optional.

A phone number will consist of area code, exchange, extension and type. For instance, with the number 216-687-2000, 216 is the area code, 687 is the exchange and 2000 is the extension. All fields are long (not strings).

A course will consist of a department name (3 characters), number (long), semester (string), year (long), credit hours(long) and grade (2 characters).

Fields in all objects need the appropriate set and get routines (still no properties).

The student object has set and get routines for all data. The student object also methods to return the student’s GPA, number of hour attempted, number of hours completed (assume only C- and higher count toward graduation). equals and compareto in the student object are dependent only on the ID field and the tostring only returns their name and ID.

All objects also need Equals and ToString methods.

Reiterating, after reading in the information from the file(s), the program asks the end user to add, update or look up information until the end user is done. When done the program optionally writes the information back into the file(s).

Using a GUI will greatly help in adding or updating a student record, however it is not required. When looking up information of a student, simply display all information including the. Optionally you might want a few ways to display a student’s information – everything, contact information only, school information only, or short school info only (no individual course info).

Subscribe For Latest Updates
Let us notify you each time there is a new assignment, book recommendation, assignment resource, or free essay and updates