Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

You are given a partially completed program hw04q1.c. You should follow the instructions given in the program to complete the functions so that the program

You are given a partially completed program hw04q1.c. You should follow the instructions given in the program to complete the functions so that the program executes as instructed. You will need to implement three functions. The program declares a struct studentRecord with elements for student's name, student's major, school year of student, student ID. You will be completing a program that creates a list of students (array of structures). It is a menu-driven program where the user is given the following options: a) Add a new student to the list. When adding a new student to the list, the user is prompted for student's name, student's major, school year of student and student ID. The student should be added at the end of the list. If the student already exists in the list, then you should not add to the list. The school year is enum type. b) Display the list of students. This should display each students details one after the other. c) Sort the list of students alphabetically by student name. The sorting should happen within the list. You should not create a new list (array of structs) of students having sorted students. There is save() already implemented to write the students list to a file Student_List.txt. save() is executed when the user quits the program. You need to implement load() which is called at the start of the program. This function will read the saved file and fill in the array of structures. You need to read the file in the same order and manner that it is saved in save(). Expected output of each function:

image text in transcribed

image text in transcribed

image text in transcribed

Notice that since this is the first execution of the program, load() gave the message "Student_List.txt not found". This file is created at the end of the program by save(). (after adding and sorting 3 student details) Enter your selection: a: add a new student d: display student list q: quit a Enter student name: William Borges Enter major: Software Engineering Enter whether students is 'freshman' or 'sophomore' or 'junior' or 'senior': senior Please student ID number: 202 Student successfully added to the list! Enter your selection: a: add a new student d: display student list q: quit display: Enter your selection: a: add a new student d: display student list q: quit d Student name: David Luiz Major: Computer Science School year: freshman Student ID: 155 Student name: Eden Hazard Major: Computer Science school year: junior Student ID: 101 Student name: William Borges Major: Software Engineering School year: senior Student ID: 202 Enter your selection: a: add a new student d: display student list q: quit The 3 students seen in display() output above and they are sorted. Use ' d ' option to verify sorted result. load: Students record loaded from student_List, txt. Enter your selection: a: add a new student d: display student 1 ist q : quit Student name: David Luiz Major: Computer science School year: freshman Student ID: 155 Student name: Eden Hazard Major: Computer Science School year: junior: Student ID: 101 Student name: William Borges Major: Software Engineering school year: senior Student ID: 282 Enter your selection: a: add a new student d: display student 1 ist q:quit Notice the message given by load() "Students record loaded from Student_List.txt" at the top. To verify that load() worked as expected, use ' d ' display option to display loaded list

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Management An Organizational Perspective

Authors: Richard T. Watson

1st Edition

0471305340, 978-0471305347

More Books

Students also viewed these Databases questions