File Program

1. Display the selection menu shown in Figure 1.
οƒΌ Processthe user’sselection using a π‘†π‘ŠπΌπ‘‡πΆπ» structure and ensure to account for lowercase and uppercase entries.
οƒΌ If the user enters A αˆΊπ‘œπ‘Ÿ π‘Žαˆ», invoke the function π‘”π‘Ÿπ‘Žπ‘‘π‘’π‘‡π‘Žπ‘π‘™π‘’αˆΊ ሻ. Once done, prompt the user again.
οƒΌ If the user enters B αˆΊπ‘œπ‘Ÿ π‘αˆ», invoke the function π‘“π‘–π‘™π‘’π‘†π‘’π‘šπ‘šπ‘Žπ‘Ÿπ‘¦αˆΊ ሻ. Once done, prompt the user again.
οƒΌ If the user enters C αˆΊπ‘œπ‘Ÿ π‘αˆ», terminate the program and print the message π‘ƒπ‘Ÿπ‘œπ‘”π‘Ÿπ‘Žπ‘š π‘‘π‘’π‘Ÿπ‘šπ‘–π‘›π‘Žπ‘‘π‘’π‘‘.
οƒΌ If the user enters another value, show an error message and PROMPT the user again. The program should never
terminate unless the user selects the exit option.
2. π‘”π‘’π‘‘πΏπ‘’π‘‘π‘‘π‘’π‘ŸπΊπ‘Ÿπ‘Žπ‘‘π‘’αˆΊ ሻ: accepts one parameter of type π‘“π‘™π‘œπ‘Žπ‘‘ and returns the corresponding letter grade as follows:
Range Letter Grade
0 59 F
60 69 D
70 79 C
80 89 B
90 100 A
Other X
3. π‘π‘Ÿπ‘–π‘›π‘‘πΊπ‘Ÿπ‘Žπ‘‘π‘’π‘‡π‘Žπ‘π‘™π‘’αˆΊ ሻ: utilizes the function π‘”π‘’π‘‘πΏπ‘’π‘‘π‘‘π‘’π‘ŸπΊπ‘Ÿπ‘Žπ‘‘π‘’αˆΊ ሻ and prints the table shown in Figure 4. You may
pick the proper column width to format and print the table.
4. π‘“π‘–π‘™π‘’π‘†π‘’π‘šπ‘šπ‘Žπ‘Ÿπ‘¦αˆΊ ሻ:
οƒΌ Open the file “grades.dat”.
οƒΌ If the file cannot be opened, display the error message “πΈπ‘Ÿπ‘Ÿπ‘œπ‘Ÿ, π‘π‘Žπ‘›π‘›π‘œπ‘‘ π‘œπ‘π‘’π‘› 𝑓𝑖𝑙𝑒: π‘”π‘Ÿπ‘Žπ‘‘π‘’π‘ . π‘‘π‘Žπ‘‘”
οƒΌ Once the file is successfully opened, print the table shown in Figure 6 and use the function π‘”π‘’π‘‘πΏπ‘’π‘‘π‘‘π‘’π‘ŸπΊπ‘Ÿπ‘Žπ‘‘π‘’αˆΊ ሻ.
οƒΌ Compute and print the π‘šπ‘–π‘›π‘–π‘šπ‘’π‘š, π‘šπ‘Žπ‘₯π‘–π‘šπ‘’π‘š, and π‘Žπ‘£π‘’π‘Ÿπ‘Žπ‘”π‘’ of all grades in the file

×
New Download