CS304P Assignment 1 Solution by M.junaid Qazi
CS304P Assignment 1 Solution by M.junaid Qazi
Please carefully read the following instructions before attempting the assignment Solution.
NOTE
Don't copy-paste the same answer.
Make sure you can make some changes to your solution file before submitting copy paste
solution will be marked zero.
If you found any mistake then correct yourself and inform me.
Before submitting an assignment/GDB check your assignment requirement file.
#include <iostream>
#include <string.h>
#include <conio.h>
using namespace std;
class Student
{
public:
Student() {}
Student(string Student_Id, string Student_name, int quiz_marks1, int quiz_marks2, int
quiz_marks3, int quiz_marks4, int assignment_marks1, int assignment_marks2, int
CONTACT ON WHATSAPP
+923074960034
+92 3074960034
Mid_Term_Marks, int Final_Term_Marks);
private:
string Student_name, Student_Id;
float
quiz_marks1,
quiz_marks2,
quiz_marks3,
quiz_marks4,
assignment_marks1,
assignment_marks2,
Mid_Term_Marks,
Final_Term_Marks,
Total_Marks;
float totalQuiz, TotalAssignment, TotalMidterm, TotalFinalterm;
public:
void enterData(string Student_Id, string Student_name, int quiz_marks1, int quiz_marks2,
int quiz_marks3, int quiz_marks4, int assignment_marks1, int assignment_marks2, int
Mid_Term_Marks, int Final_Term_Marks);
void calculateQuiz();
void calculateAssignment();
void calculateMidterm();
void calculateFinalterm();
void calculateTotalMarks();
void displayData();
Student(Student &obj)
CONTACT ON WHATSAPP
+923074960034
+92 3074960034
{
this->Student_Id = obj.Student_Id;
this->Student_name = obj.Student_name;
this->quiz_marks1 = obj.quiz_marks1;
this->quiz_marks2 = obj.quiz_marks2;
this->quiz_marks3 = obj.quiz_marks3;
this->quiz_marks4 = obj.quiz_marks4;
this->assignment_marks1 = obj.assignment_marks1;
this->assignment_marks2 = obj.assignment_marks2;
this->Mid_Term_Marks = obj.Mid_Term_Marks;
this->Final_Term_Marks = obj.Final_Term_Marks;
}
};
Student::Student(string Student_Id, string Student_name, int quiz_marks1, int
quiz_marks2, int quiz_marks3, int quiz_marks4, int assignment_marks1, int
assignment_marks2, int Mid_Term_Marks, int Final_Term_Marks)
{
enterData(Student_Id, Student_name, quiz_marks1, quiz_marks2, quiz_marks3,
quiz_marks4, assignment_marks1, assignment_marks2, Mid_Term_Marks,
Final_Term_Marks);
}
void Student::enterData(string Student_Id, string Student_name, int quiz_marks1, int
quiz_marks2, int quiz_marks3, int quiz_marks4, int assignment_marks1, int
assignment_marks2, int Mid_Term_Marks, int Final_Term_Marks)
{
this->Student_Id = Student_Id;
this->Student_name = Student_name;
CONTACT ON WHATSAPP
+923074960034
+92 3074960034
this->quiz_marks1 = quiz_marks1;
this->quiz_marks2 = quiz_marks2;
this->quiz_marks3 = quiz_marks3;
this->quiz_marks4 = quiz_marks4;
this->assignment_marks1 = assignment_marks1;
this->assignment_marks2 = assignment_marks2;
this->Mid_Term_Marks = Mid_Term_Marks;
this->Final_Term_Marks = Final_Term_Marks;
}
void Student::calculateQuiz()
{
this->totalQuiz = (((this->quiz_marks1 + this->quiz_marks2 + this->quiz_marks3 +this-
>quiz_marks4)) / 40) * 10;
}
void Student::calculateAssignment()
{
this->TotalAssignment = (((this->assignment_marks1 + this->assignment_marks2)) / 40) *
20;
}
void Student::calculateMidterm()
{
this->TotalMidterm = ((this->Mid_Term_Marks) / 40) * 30;
}
void Student::calculateFinalterm()
{
CONTACT ON WHATSAPP
+923074960034
+92 3074960034
this->TotalFinalterm = ((this->Final_Term_Marks/ 60 ) * 40);
}
void Student::calculateTotalMarks()
{
this->Total_Marks = (this->totalQuiz + this->TotalAssignment + this->TotalMidterm +
this->TotalFinalterm);
}
void Student::displayData()
{
calculateQuiz();
calculateAssignment();
calculateMidterm();
calculateFinalterm();
calculateTotalMarks();
cout << this->Student_Id << "\t\t\t" << this->Student_name << "\t\t" << this-
>TotalMidterm << "\t\t" << this->TotalFinalterm << "\t\t" << this->Total_Marks <<endl;
}
CONTACT ON WHATSAPP
+923074960034
+92 3074960034
string student_name, student_id;
bool flagquiz = true;
bool flagAssignment = true;
bool flagMidTerm = true;
bool flagFinalTerm = true;
cout<<" Solution By M.junaid Qazi "<<endl;
cout << " TO Get Solution Contact On +923074960034 "<<endl;
cout<<"---------------------------------------------------------------------------------------------------
-------------------"<<endl;
CONTACT ON WHATSAPP
+923074960034
+92 3074960034
else
{
cout << "Invalid Marks,Quiz Marks should be between 0-10." << endl;
cout << "Enter marks for Quiz" << (i + 1) << " <out of 10>";
cin >> quizmarks[i];
flagquiz = true;
}
}
while (flagquiz);
}
CONTACT ON WHATSAPP
+923074960034
+92 3074960034
cout << "Enter marks for Assignment" << (i + 1) << " <out of 20>";
cin >> assignment[i];
flagAssignment = true;
}
}
while (flagAssignment);
}
CONTACT ON WHATSAPP
+923074960034
+92 3074960034
while (flagMidTerm);
CONTACT ON WHATSAPP
+923074960034
+92 3074960034
std[2] = Student(std[1]);
cout << "Sutdent ID"
<< "\t\t"
<< "StudentName"
<< "\t"
<< "MidTermMarks"
<< "\t"
<< "FinalTermMArks"
<< "\t\t"
<< "TotalMarks" << endl;
cout << "--------------------------------------------------------------------------------------------------
--------" << endl;
std[0].displayData();
std[1].displayData();
std[2].displayData();
delete []std;
return 0;
}
CONTACT ON WHATSAPP
+923074960034
+92 3074960034
Out Put:
M.juniad Qazi
WHATSAPP +923074960034
CONTACT ON WHATSAPP
+923074960034
+92 3074960034