Write a program that reads from a text file students.txt student information of a given class and
Question:
Write a program that reads from a text file "students.txt" student information of a given class and stores them into a list of dictionaries. Each line of the file contains a student id (integer), a student name, a student gpa (float), and the number of completed credits (integer). The program should then display the menu shown below allowing the user to select repeatedly an option until he or she chooses to quit:
P: Print the student information (name. id, gpa and credits) ofall students sorted in alphabetic order of their names
F: Find and display student information for a given student id (the user enters the student id)
L: List all the information ad. gpa and credits) of all students under probation (i.e. gpa < 2.0)
D: Delete the student information for a given student id (the user enters the student id)
E: Exit the program after saving into the file “student:txt” the modifications made during the session
Your program must define and use at least the following functions with suitable parameters:
1. readStudentInfo (...): reads the student information from the input file and stores It in the list of dictionaries. Note that the information in the file is in increasing order of student id.
2. Menu (...): displays the menu and returns the user's choice
3. FindStudent (...): returns the position (index) of the student with given id, in the complex structure if found otherwise it returns -1.
4. DeleteStudentInfo (...): deletes from the complex structure the information of a student with the given id. If the given student Id is not found, it prints an error message and does not make any changes. This function should use a binary search algorithm when searching for the student id.
5. PrintStudentinfo (...): prints all students' information in a tabular format.
6. SaveStudentInfo(...): saves back the modified students' information into the file students.txt. The students should be stored in increasing order of their id.
Additional Requirements:
1. You should display error message whenever it's possible
2. You should answer the following question: Could you use any of the following structures instead of a list of dictionaries. If no, why? If yes, indicate its advantages/disadvantages compared to a list of dictionaries?
a) A list of sets
b) A list of lists
c) Parallel lists
Introduction to Java Programming, Comprehensive Version
ISBN: 978-0133761313
10th Edition
Authors: Y. Daniel Liang