Programming

1.Create a menu system that does the followingAccepts input valid input for numbers 1, 2, 3, 4, 5 and X. Create the following prompt filling in your own messages for xxxxx.

Press 1 to xxxxx

Press 2 to xxxxx

Press 3 to xxxxx

Press 4 to xxxxx

Press 5 to xxxxx

Press X to Exit

Use a do while loop to get input and a switch statement to validate the input. Hint use a char data type for the input.Display an appropriate error message if user does not give a valid input. 

Display the selection with an appropriate message.

SAVE as midtermprogram1.cpp

—————————————————–

2.   Create a grading program that does the following

Uses a for loop by using a program defined amount to get names and grades of the students 

Use a const int to determine how many students in the for loop. Number of students should be between 3 -5). 

Use the following arrays

string names[num or students];

int grades[num or students];

Use the following functions 

void getNames[string []);

void getGrades[int []);

int getOneGrade() – returns the grade of the student;

Call the getNames functions to input the names of the students using for loop

Loop will begin by getting the name of the student using getline.

cout << "Please enter your name: "; 

getline(cin, name[i]);

Next use a for loop to get all of the grades, 

get the grade for each student using grade[i] = getOneGrade();

getOne Grade should use a prompt, cin and then a do while loop that forces the user to put in a valid input between 0 and 100. Use const int LOW_GRADE and HIGH_GRADE

Note – No 2 grades should be the same in order to do the bonus section. 

Remember to do an ignore before the cin to get the grade.

cin.ignore(20,’n’);

cin >> grades

Put the grade input in a do while loop. Use constants for the lowest and highest allowed grades

Use an if else if to get the string grade with the following specifications. Hint start with the highest grades

96 -100A+

93 – 95A

90 – 92A-

86 – 89B+

83 – 85B

80 – 82B-

76 -79C+

73 – 75C

70 – 72C-

66 -69D+

63 – 65D

60 – 62D-

Below 59F

Use another for loop to display the students’ names and their grades

Calculate and display the average of the grades.

Bonus – Determine and display who had the highest grade

SAVE AS midtermprogram2.cpp

Tags: No tags