Vous êtes sur la page 1sur 7

Computation of Prelim Grade

Problem
This program requires necessary information and inputs that would be used to compute for
the preliminary grade of a student. First, it accepts data about the student which includes his
ID number, name, and degree program. After this, the program requires inputs regarding the
students overall performance; components of which include 3 quizzes, 7 laboratory
activities, assignment, and the preliminary exam. These inputs are in the form of scores and
number of items. After the inputs are entered, the program computes and displays the total
scores and total items from each component, and also the percentage equivalence. The
percentage equivalence from the quizzes, activities and assignment will be added to
compute for the Class Standing. From there, the percentage equivalence of the prelim exam
is also added to compute for the Prelim Raw Score (in decimal). Finally, the Prelim Grade (in
decimal) is computed by adding 0.5 to the half of the Prelim Raw Score (PRS/2 + 0.5).

Program
#include <iostream>
#include <math.h>
using namespace std;
void main ()
{
Int
q1,q2,q3,act1,act2,act3,act4,act5,act6,act7,ass,exam,iq1,iq2,iq3,iact1,iact2,iact3,iact
4,iact5,iact6,iact7,iass,iexam,Tquiz,Tact,Tiquiz,Tiact;
char id[10],lname[25],fname[25],prog[20];
double qPE,actPE,assPE,examPE,CS,PRS,PG;
cout<<"ID Number: ";
cin.getline (id,10);
cout<<"Last Name: ";
cin.getline (lname,25);
cout<<"First Name: ";
cin.getline (fname,25);
cout<<"Program: ";
cin.getline (prog,20);
cout<<endl;
cout<<endl;
cout<<"_____________________________________________"<<endl;
cout<<" COMPUTATION OF PRELIM GRADE "<<endl;
cout<<"_____________________________________________"<<endl;
cout<<" Quizzes (20%) "<<endl;
cout<<"_____________________________________________"<<endl;
cout<<"Enter First Quiz: ";
cin>>q1;
cout<<" Number of Items: ";
cin>>iq1;
cout<<"Enter Second Quiz: ";
cin>>q2;
cout<<" Number of Items: ";
cin>>iq2;
cout<<"Enter Third Quiz: ";
cin>>q3;
cout<<" Number of Items: ";
cin>>iq3;
Tquiz=q1+q2+q3;
Tiquiz=iq1+iq2+iq3;
qPE=0.2*Tquiz/Tiquiz;
cout<<"_____________________________________________"<<endl;
cout<<"Total Quizzes: "<<Tquiz<<endl;
cout<<"Total Items: "<<Tiquiz<<endl;
cout<<endl;
cout<<"Percentage Equivalence: "<<qPE<<endl;
cout<<"_____________________________________________"<<endl;
cout<<" Activities (20%) "<<endl;
cout<<"_____________________________________________"<<endl;
cout<<"Enter First Activity: ";
cin>>act1;
cout<<" Number of Items: ";
cin>>iact1;
cout<<"Enter Second Activity: ";
cin>>act2;
cout<<" Number of Items: ";
cin>>iact2;
cout<<"Enter Third Activity: ";
cin>>act3;
cout<<" Number of Items: ";
cin>>iact3;
cout<<"Enter Fourth Activity: ";
cin>>act4;
cout<<" Number of Items: ";
cin>>iact4;
cout<<"Enter Fifth Activity: ";
cin>>act5;
cout<<" Number of Items: ";
cin>>iact5;
cout<<"Enter Sixth Activity: ";
cin>>act6;
cout<<" Number of Items: ";
cin>>iact6;
cout<<"Enter Seventh Activity: ";
cin>>act7;
cout<<" Number of Items: ";
cin>>iact7;
Tact=act1+act2+act3+act4+act5+act6+act7;
Tiact=iact1+iact2+iact3+iact4+iact5+iact6+iact7;
actPE=0.2*Tact/Tiact;
cout<<"_____________________________________________"<<endl;
cout<<"Total Activities: "<<Tact<<endl;
cout<<"Total Items: "<<Tiact<<endl;
cout<<endl;
cout<<"Percentage Equivalence: "<<actPE<<endl;
cout<<"_____________________________________________"<<endl;
cout<<" Assignment (10%) "<<endl;
cout<<"_____________________________________________"<<endl;
cout<<"Enter Assignment: ";
cin>>ass;
cout<<" Number of Items: ";
cin>>iass;
assPE=.1*ass/iass;
cout<<endl;
cout<<"Percentage Equivalence: "<<assPE<<endl;
cout<<"_____________________________________________"<<endl;
cout<<"_____________________________________________"<<endl;
CS=qPE+actPE+assPE;
cout<<endl;
cout<<"CLASSS STANDING: "<<CS<<endl;
cout<<endl;
cout<<endl;
cout<<"_____________________________________________"<<endl;
cout<<" Prelim Examination(50%) "<<endl;
cout<<"_____________________________________________"<<endl;
cout<<"Enter Exam Score: ";
cin>>exam;
cout<<" Number of Items: ";
cin>>iexam;
examPE=.5*exam/iexam;
cout<<endl;
cout<<"Percentage Equivalence: "<<examPE<<endl;
PRS=CS+examPE;
PG=PRS/2+.50;
cout<<"_____________________________________________"<<endl;
cout<<"_____________________________________________"<<endl;
cout<<endl;
cout<<endl;
cout<<endl;
cout<<"PRELIM RAW SCORE: "<<PRS<<endl;
cout<<endl;
cout<<endl;
cout<<"PRELIM GRADE: "<<PG<<endl;
cout<<endl;
cout<<"_____________________________________________"<<endl;
cout<<"_____________________________________________"<<endl;
}
Output
Discussion

For creating a program and source file see Discussion of Activity 1 and for
introduction of the main program, introduction of variables and input of characters involving
personal information, see Discussion of Activity 4.
After the personal information is entered, proceed to the program that accepts the
score and number of items from each component, based on the students academic
performance. Display first an output showing the title COMPUTATION OF PRELIM
GRADE.
Next, display also the title of the first component (i.e. Quizzes (20%)). After this,
use cout and cin to provide an output asking for the user to enter his quiz scores and the
number of items, and to assign a variable name from each input entered, respectively. They
are used simultaneously until it reaches the 3rd quiz. After these inputs, proceed to the
process or computation. Create formulas that will add all the scores and items. A formula for
Percentage equivalence shall also be used by dividing the total score by the total number of
items, then multiplying the result to the percentage of quizzes which is 20% (tquiz/tiquiz*0.2).
Then, use cout again to display the results of these computations. The resulting amounts
are in decimal form.
The procedure from the preceding paragraph will also be applied to the other
components. However, after these procedures are applied to the 3 components (quizzes,
activities, and assignment), there is a need to compute for the Class Standing. To do so, just
create a formula that adds the Percentage Equivalences of the 3 components (i.e.
CS=qPe+actPe+assPE). Again, use cout to display the result.
After the Class Standing, proceed to the prelim exam. The same procedures are
applied from that of the first components. When the total exam score and items, and the
exam percentage equivalence are already computed, create another formula that computes
for the Prelim Raw Score and of course the Prelim Grade. The Prelim Raw Score is
computed by adding the Class Standing and the percentage equivalence of the prelim exam
(PRS=CS+examPE). Then compute for the Prelim Grade by dividing the Prelim Raw Score
by 2, and adding the result to 0.5 or 50%. Finally, use cout again to display the result of the
Prelim Raw Score and the Prelim Grade.
For ending the main program, see Discussion of Activity 4.
Note that the design of the program depends on your choice. It may include spaces
and lines as separation.
Start the program(See Discussion of Activity 1).

Vous aimerez peut-être aussi