create a C++ program for them. Your program should do the following:
1. Read student information for 20 semester 1 students. The student information includes the following:
a) Student name
b) Student surname
c) Student id
d) Program
e) Module code
f) Test one mark
g) Test two mark
h) Project mark
i) Tutorials mark
LIMKOKWING
UNIVERSITY
CREATIVE
j) Final exam mark
2. For the following use functions.
a) Calculate and return the final mark for each student.
Final mark = 10% testl + 15% test2 + 15% tutorial + 20% project +
40% exam
b) Determine the grade using the final mark.
Final mark Grade
80 - 100
70 - 79
60 - 69 c o - 59
40 — 49
30-39 F
c) Find the highest and lowest mark.
d) Find the class average mark.
3. Your program should ask the user if he or she wants a class report or an individual report.
#include <stdio.h>
struct student {
string name;
string surname;
int id;
string program;
string code;
int markOne;
int markTwo;
int project;
int tutorial;
int examMark;
};
double finalMark(student s) {
return 0.10 * s.markOne
+ 0.15 * s.markTwo
+ 0.15 * s.tutorial
+ 0.20 * s.project
+ 0.40 * s.examMark;
}
int main() {
student s;
cin >> s.name
>> s.surname
>> s.id
>> s.program
>> s.code
>> s.markOne
>> s.markTwo
>> s.project
>> s.tutorial
>> s.examMark;
cout << finalMark(s);
return 0;
}
Comments
Leave a comment