[SOLVED] CSC111 Assignment2-Functions-CPP-main

35.00 $

Category:
Click Category Button to View Your Next Assignment | Homework

You will receive the following solution file(s) instantly after successful payment:

zip file icon Functions-CPP-main-kvtrb8.zip (346.1 KB)
Assignment Instructions Updated Recently? Submit Below and we will provide new Solution!
Submit New Instructions
πŸ”’ Securely Powered by:
Secure Checkout
5/5 - (1 vote)

Assignment’s Instructions

Write a C++ program which performs the following steps. Pay attention to any of the compiler’s warning messages. Remember to comment your code. Comments should explain every major step in your code.

  1. Display the selection menu shown in Figure 1.
    • Process the user’s selection 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
  1. π‘π‘Ÿπ‘–π‘›π‘‘πΊπ‘Ÿπ‘Žπ‘‘π‘’π‘‡π‘Žπ‘π‘™π‘’ : utilizes the function π‘”π‘’π‘‘πΏπ‘’π‘‘π‘‘π‘’π‘ŸπΊπ‘Ÿπ‘Žπ‘‘π‘’ and prints the table shown in Figure 4. You may pick the proper column width to format and print the table.
  2. π‘“π‘–π‘™π‘’π‘†π‘’π‘šπ‘šπ‘Žπ‘Ÿπ‘¦ :
    • 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. See the bottom of Figure 6

Assessment:

Figures

Β 

Figure 1: Selection Menu

 

Figure 2: invalid entries print an error message and prompts the user again

 

Figure 3: option β€˜c’ terminates the program. Note the message before the program ends.

 

Figure 4: option β€˜A’ prints the letter conversion table and prompts the user again

Figure 5: option β€˜B’ prints an error message if the file cannot be opened and prompts the user again

 

Figure 6: option β€˜B’ reads the file grades.dat, prints the table and prompts the user again

 

  • Functions-CPP-main-kvtrb8.zip