It is the year 2075, the CruzX Space Inc. (CruzX). has grown so much that it cannot find enough scientists and engineers to hire. Therefore, the company created The CruzX Space University (CXSU) to train the next generation of space scientists and engineers. The company is keeping track of its students' information. using an old system of text files but plans to implement a new system soon. Your job for this project is to make sure that the data in the files is not corrupted.
Write a program that:
1. Asks the user for an input file name and validates that the user entered a valid file name (name of an existing file).
2. If the user enters invalid file names 3 times, displays an error message, and quits.
3. Reads from the input file the names of students (don't make assumptions about how many students) and their grades (1..4 grades per student, default missing grades to 0). The names of the students and the grades will be stored in a dictionary where the names are the keys, and the grades are stored in a list associated with the key.
4. After reading the student information into the dictionary, displays the name of each student followed by their grades followed by the grade average to the console as follows:
Student 1 Grade 1 Grade 2 Grade 3 Grade 4 Average
Student 2 Grade 1 Grade 2 Grade 3 Grade 4 Average
Student 3 Grade 1 Grade 2 Grade 3 Grade 4 Average
Student 4 Grade 1 Grade 2 Grade 3 Grade 4 Average
Dictionary + List:
{Student1:[Grade1, Grade2, Grade3, Grade4], Student2:[Grade1, Grade2, Grade3, Grade4], Student3:[Grade1, Grade2, Grade3, Grade4]}
Structure of input file:
Student 1Name
Student 1 Grade 1
Student 1 Grade 2
Student 2 Name
Student 2 Grade 1
Student 3 Name
Student 3 Grade 1
Student 4 Name
Student 4 Grade 1
Student 4 Grade 2
Student 4 Grade 3
Student 4 Grade 4
For Example:
Rodolfo
98.9
99.5
Julio
75
Pedro
100
Maria
99
99.8
90
80