Question: Part 1 : Use input ( ) to ask for a file name. The file must exist in the same folder as the program. Then

Part 1:
Use input() to ask for a file name. The file must exist in the same folder as the program. Then ask for a class name, such as CS160, MATH 165, or ECON 201. IF the user enters a class name, ask for the anticipated grade and number of credits (integer value). Continue to accept course information until the user enters an empty string for the class name. Write the information for each class to the file as it is entered, all on a single line. Separate the data for each class with a colon (":"). Make sure to close the file once the user has finished entering in the data. The line in the file for this course could be: CSCI 160:A:4
Part 2:
Use input() to ask for a file name. Use the data file(s) created in part 1. Do not let the program
crash if you enter the name of a file that does not exist. If the file does not exist, gracefully display an error message stating the file doesnt exist and quit the program.
If the file does exist, read each line and display, in table format, all the courses from the file. The class names should be left aligned, the letter grades should all be aligned, as well as the number of credits.
You will need to determine the students grade point average (GPA) for that semester. To determine a students GPA, you divide the number of honor points by the number of attempted credits. To determine honor points, multiple the number of credits by either 4 for an A,3 for a B,
2 for a C,1 for a D, or 0 for an F. This program will ignore grades of pass, fail, or incomplete.
For example, if you received a 4 credit A and a 3 credit B in a semester, for honor points you will
earn:
4*4(A)=16
3*3(B)=9
25 honor points /7 attempted credits =3.571429, which will be truncated in the output to 3
NO error checking is required, other than what is specifically required.
The class name will be no longer than 8 characters. No grade other than A, B, C, D, or F will be entered. You cannot assume that the grade will be entered as an upper case letter, if could be a lower case letter. When saving the letter grade make sure it is in upper case.
A students GPA defaults to 0.0 if their GPA cannot be calculated. This is consistent with student GPA s, as discussed in class. Once all of the class information has been displayed, print out a single blank line and then the following information, in the order specified, with any preceding text on the line ending with a colon.
Grade point average, with 3 places after the decimal point
Number of credits attempts
Number of credits passed (any grade other than an F)
Number of classes attempted
Number of classes passed (any grade other than an F)
Ensure that this output has neatly aligned columns, with the text left justified and all the numbers right justified. The width of the descriptive statistics table does not have to be the same width as the list of classes

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!