#include<iostream> using namespace std; class gpa { private: unsigned int marks; double gpa12; char subject[70]; int total; float per; public: gpa(int totl,int mrks,float gp,char sub[] ):total(totl),marks(mrks),gpa12(gp) { strcpy(subject,sub); } gpa():marks(0),total(0) { strcpy(subject,"n/a"); } void getmarks() { cin>>marks; } double calgpa() { if(marks>=85 && marks<=100) { return gpa12=4.0; } else if (marks>=80 && marks<85) { return gpa12=3.7; } else if (marks>=75 && marks<80) { return gpa12=3.3; } else if (marks>=70 && marks<75) { return gpa12=3.0; } else if (marks>=65 && marks<70) { return gpa12=2.7; } else if (marks>=61 && marks<65) { return gpa12=2.3; } else if (marks>=58 && marks<61) { return gpa12=2.0; } else if (marks>=50 && marks<58) { return gpa12=1.0; } else if(marks<=0) { return gpa12=0; } } void showgpa() { cout<<subject;cout<<" ",cout<<total;cout<<" "; } void add(gpa dld,gpa oop,gpa discrete,gpa comskills,gpa calcls,gpa stats) { float gpa12; gpa12=(dld.gpa12*3+oop.gpa12*4+discrete.gpa12*3+comskills.gpa12*3+calcls.gpa12*3+stats.gpa12*3)/19.0; cout<<" "<<"Result:"<<endl; cout<<" "<<"GPA = "<<gpa12<<endl; } void percentage() { per=marks/100; } void grade() { if(marks>=85 && marks <=100) cout<<"A+"; else if(marks>=80 && marks <85) cout<<"A"; else if(marks>=75 && marks <80) cout<<"B+"; else if(marks>=70 && marks <75) cout<<"B"; else if(marks>=65 && marks <70) cout<<"B-"; else if(marks>=61 && marks <65) cout<<"C+"; else if(marks>=58 && marks <61) cout<<"C"; else if(marks>=50 && marks <58) cout<<"D"; else if(marks<50) cout<<"F"; } void presentation() { cout<<subject<<" "<<"100 "<<marks<<" "<<gpa12<<" ",grade(),cout<<endl; } void total1(gpa dld,gpa oop,gpa discrete,gpa comskills,gpa calcls,gpa stats) { int total1=(dld.marks+oop.marks+discrete.marks+comskills.marks+calcls.marks+stats.marks); cout<<"Total 600 "<<total1<<" __ __ "<<endl; } };//endclass int main() { gpa dld(100,0,0.0,"DLD "),oop(100,0,0.0,"OOP "),discrete(100,0,0.0,"Discrete Math "),comskills(100,0,0.0,"Comm Skills"),calcls(100,0,0.0,"Calculus 2 "),stats(100,0,0.0,"Statistics "),sum,total1; cout<<"Enter your marks in following subject"<<endl; cout<<"-------------------------------------------------------------------------------"<<endl; cout<<"Subject Total marks Obtained marks"<<endl; cout<<"------------------------------------------------------------------------------"<<endl; dld.showgpa();dld.getmarks(); oop.showgpa();oop.getmarks(); discrete.showgpa();discrete.getmarks(); comskills.showgpa();comskills.getmarks(); calcls.showgpa();calcls.getmarks(); stats.showgpa();stats.getmarks(); cout<<"-------------------------------------------------------------------------------"<<endl; dld.calgpa(); oop.calgpa(); discrete.calgpa(); comskills.calgpa(); calcls.calgpa(); stats.calgpa(); sum.add(dld,oop,discrete,comskills,calcls,stats); cout<<" "<<"DETAIL:"<<endl; cout<<"--------------------------------------------------------------------------------"<<endl; cout<<"Subject T_marks O_marks GP Grade"<<endl; cout<<"-------------------------------------------------------------------------------"<<endl; dld.presentation(); oop.presentation(); discrete.presentation(); comskills.presentation(); calcls.presentation(); stats.presentation(); cout<<"--------------------------------------------------------------------------------"; total1.total1(dld,oop,discrete,comskills,calcls,stats); cout<<"--------------------------------------------------------------------------------"; cout<<endl<<endl<<"DEVELOPED BY : Programming passion tea"<<endl; return 0; }
Subscribe to:
Post Comments (Atom)
Post A Comment:
0 comments: