Hi. This is a new topic. Pls. Help i need a code

Here is the info guys



1. Write a program that uses a function which computes for the Prelim Grade.

With the following details:
a. Quizzes ( Average of 3)
b. Exercises ( Average of 3 )
c. Class Participation
d. Class Standing
a. Class Standing (CS)= 50%( Average Quiz) + 30% (Class Participation) + 20%(Average Assignment)
e. Prelim Exam
f. Prelim Grade
a.

Requirements:
1. Create one main program (.cpp)
2. 3 functions are needed for the exercise. (.h)
a. Average function for Quizzes and Exercise (we have completed this in our previous exercise)
b. Function on Class Standing ( see formula above)
c. Function on the Prelim Grade ( see formula above)



 Make sure to turn in 4 files - main program (.cpp) and Function (.h)






Please take note the output that - Quiz 1 , Quiz 2 , Quiz 3 , Exercise 1, Exercise 2, Exercise 3 , Class Participation , and Prelim Exam are user input.
Last edited on
What do you mean by "a header file for this"?

What is the header file for? What are you planning to put in it?

Please use code tags when posting code here.
Here. I think this is what you were asking for:

main.cpp:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#include <iostream> 
#include "quiz.h"
#include "exercise.h"
int main () 
{ 
int a, b, c;
std::cout << ("Quizes(q) or Exercises(e)?: ");
char input;
std::cin >> input;
if(input == 'q')
{
std::cout << "Input Quizzes\n"; 
std::cout << ("Quiz 1:\t"); 
std::cin >> c ; 
std::cout << ("Quiz 2:\t"); 
std::cin >> b ; 
std::cout << ("Quiz 3:\t");
std::cin >> a;  
std::cout << ("Average Quizzes:") << (average_quiz(a, b, c)) << ("\n\n");
}
if(input == 'e')
{
std::cout << ("Input Exercises\n");
std::cout << ("Exercise 1:\t") ; 
std::cin >> c ; 
std::cout << ("Exercise 2:\t") ; 
std::cin >> b ; 
std::cout << ("Exercise 3:\t"); 
std::cin >> a;
std::cout << ("Average Exercises:") << (average_exercise(a, b, c)) << ("\n\n");
}
else
{
std::cout << ("Invalid option: ") << (input) << std::endl;
return(-1);
}
std::cin.get(); 
return 0; 
}


exercise.h:
1
2
3
4
5
double average_excerise (int value1, int value2, int value3)
{
    double result = ((value1+value2+value)/3);
    return(result);
}


quiz.h:
1
2
3
4
5
double average_quiz (int value, int value2, int value3)
{
    double result2 = ((value1+value2+value)/3);
    return(result2);
}
Last edited on
Topic archived. No new replies allowed.