C++ program to allow processing of exam grades for students in a course Solved

30.00 $

Category:

Description

You will design and implement a menu-based program using C++ programming language to allow processing of exam grades for students in a course.

 The Main Menu

Your program will start by showing a main menu to the user. The menu will have the following parts

  1. Input a student grade
  2. Display all grades
  3. Display a Student’s exam statistics
  4. Display an Exam’s statistics
  5. Exit

Your program will ask the user to make a choice from the menu and accordingly complete the requested ask and go back to the main menu. The program will terminate only when the user chooses the ‘Exit’ option in the main menu. Make sure to add Input Validation to your program, so that the user is asked to enter a menu choice until the entered choice is valid. For example, if the user enters an invalid choice such as 0, 5, or -1, … etc. the user will be asked to enter the menu choice again. Hint: You need to write a loop to ask the user’s menu choice.

Choice: Input a Student’s Grades

When the user selects this choice, the program will ask the user to enter the four pieces of information:

 

  • Student ID: should be a number between 1-9999
  • Exam 1 grade: should be a number between 0-100
  • Exam 2 grade: should be a number between 0-100
  • Exam 3 grade: should be a number between 0-100

 

Make sure to add Input Validation to your program, so valid range of numbers are entered for each of Student ID and Exam,1, 2, and 3 grade (Hint: You need a loop when asking each piece of information).

After the user enters all the information for a single student, the program will record the data to a text file (you can name your text file as “grades.txt”). Each line of the text file will have information about a single student as below

StudentID     Exam1Grade    Exam2Grade    Exam3Grade

Once the student is added (hint: you need to append) to the text file, your program will go back to the main menu (that is show the main menu to the user again to allow the user make another choice from the main menu).

Choice: Display all grades

When the user selects this option,  your program will open the text file and read all of the data (all the studentIDs, and exam grades) and display it in a nicely formatted manner on the screen. Make sure

  • to show column headers and
  • align the columns on the screen.

 

You can use system(“cls”) to clear the screen before showing the data on the screen. Your program then should pause to allow the user view the displayed data (hint: you can use system(“pause”) or cin.get() function calls).

 

Finally, your program needs to go back to the main menu (that is show the main menu to the user again to allow the user make another choice from the main menu).

Choice: Display a Student’s Exam statistics

 

When the user selects this option, you will ask the user to enter the studentID. Then you will open the text file and search for this ID.

  • If you cannot find the entered ID in the text file, displaying a message “The student ID and record cannot be found”
  • If the ID is found in the text file, then show the Exam1, 2, 3 grades for the student and also the average of the three exam grades

You can use system(“cls”) to clear the screen before showing the data on the screen. Your program then should pause to allow the user view the displayed data (hint: you can use system(“pause”) or cin.get() function calls).

 

Finally, your program needs to go back to the main menu (that is show the main menu to the user again to allow the user make another choice from the main menu).

Choice: Display an Exam’s statistics

 

When the user selects this option, you will ask the user to enter an exam number and then show the following statistics for the requested exam. Make sure to make Input Validation as the user can only enter 1, 2, 3 as exam number. (Hint: You need to use a loop when asking the exam number from the user).

You can use system(“cls”) to clear the screen before showing the data on the screen. Your program then should pause to allow the user view the displayed data (hint: you can use system(“pause”) or cin.get() function calls).

 

Finally, your program needs to go back to the main menu (that is show the main menu to the user again to allow the user make another choice from the main menu).

Requirements

  • code should be Modular Program using functions

For each sub task, such as getting an input from the user, calculating a particular value, showing the menu etc. you should write a function.

  • One or more void functions
  • One or more value returning functions
  • One or more functions with value parameters
  • One or more functions with reference parameters

Do not use any global variables, but using global CONSTANTS are allowed (2 pts) Use Comments: Use appropriately for each function, and variable names, or functionality of your code.

  • Choose Appropriate Names for your identifiers (variables, constants, and functions): Choose appropriately long and explanatory names.