Question 1) For research purposes and to better help students, the admissions office of your local university wants to know how well female and male students perform in certain courses. You receive a file which contains female and male student GPAs for certain courses. Due to confidentiality, letter code f is used for female students and m for male students. Every file entry consists of the letter code followed by the GPA. Each line has one entry. The number of entries in the file is unknown. Write a program whihc computes and outputs the average GPA for both female and male students. Format your results to two decimal places. Your program must use the following functions:
a) Function openFiles: This function opens input and output files, and sets output of the floating-point numbers to two decimal places in the fixed decimal format with the decimal point and trailing zeros.
b) Function initialize: This function initializes variables like countFemale, countMale, sumFemaleGPA, and sumMaleGPA.
c) Function sumGrades: This function finds sum of female and male students’ GPAs.
d) Function averageGrade: This function determines average GPA for female and male students.
e) Function printResults: This function outputs the appropriate results.
f) There could be no global variables. Use the suitable parameters to pass information in and out of functions.
Question 2) Write a program to convert time from 24-hour notation to 12-hour notation and vice versa. Your program should be menu driven, giving the user the choice of converting the time between the two notations. In addition, your program should contain at least the following function: a function to convert time from 24-hour notation to 12-hour notation, a function to convert time from 12-hour notation to 24-hour notation, a function to display the choices, function(s) to get the input, and function(s) to display the results. (For 12-hour time notation, your program should display AM or PM.)
Question 3) The cost to become the member of a fitness centre is as follows: (a) the senior citizens discount is 30%; (b) if the membership is bought and paid for 12 or more months, the discount is 15%; and (c) if more than five personal training sessions are bought and paid for, the discount on each session is 20%.
Write a menu-driven program which determines cost of the new membership.
Your program should contain a function which displays general information about the fitness centre and its charges, function to get all of the essential information to find out the membership cost, and function to determine membership cost. Use suitable parameters to pass information in and out of a function. (Don’t use any global variables.)
Question 4) Write a C++ function, smallestIndex, which takes as parameters an int array and its size and returns index of the first occurrence of the smallest element in the array. Also, write the program to test your function.