63 063
Assignments Done
99,1%
Successfully Done
In July 2018

Answer to Question #4689 in C++ for waqeeh

Question #4689
Create a class student that contains student number, student name and marks of
three subjects; english, mathematics and computers. Include a member function to
get data from the user, and another function to display the data.
Expert's answer
// StudentInformation.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"
#include "conio.h"
#include <iostream>

using namespace std;

class Student{

int studentnumber;
char* studentname;
double markenglish;
double markmathematics;
double markcomputers;

public:

void SetStudentnumber(int studentnumber1){
& studentnumber=studentnumber1;

}

void SetStudentname(char* studentname1){
& & studentname=studentname1;
}
void SetStudentMarkEnglish(double markenglish1){
& & markenglish=markenglish1;
}
void SetStudentMarkMathematics(double markmathematics1){
& & markmathematics=markmathematics1;
}
void SetStudentMarkComputers(double markcomputers1){
& & markcomputers=markcomputers1;
}

int GetStudentnumber(){
& & return studentnumber;
}
char* GetStudentname(){
& & return studentname;
}
double GetStudentMarkEnglish(){
& & return markenglish;
}
double GetStudentMarkMathematics(){
& & return markmathematics;
}

double GetStudentMarkComputers(){
& return& markcomputers;
}

};

int _tmain(int argc, _TCHAR* argv[])
{


Student std1,std2,std3;
std1.SetStudentnumber(1);
std1.SetStudentname("Peter");
std1.SetStudentMarkEnglish(5);
std1.SetStudentMarkMathematics(5);
std1.SetStudentMarkComputers(3);

std2.SetStudentnumber(2);
std2.SetStudentname("Bred");
std2.SetStudentMarkEnglish(5);
std2.SetStudentMarkMathematics(5);
std2.SetStudentMarkComputers(3);

std3.SetStudentnumber(3);
std3.SetStudentname("John");
std3.SetStudentMarkEnglish(5);
std3.SetStudentMarkMathematics(5);
std3.SetStudentMarkComputers(3);

cout<<std1.GetStudentnumber()<<" quot;<<std1.GetStudentname()<<"& "<<std1.GetStudentMarkEnglish()<<" quot;<<std1.GetStudentMarkMathematics()<<" quot;<<std1.GetStudentMarkComputers()<<"\n";
cout<<std2.GetStudentnumber()<<" quot;<<std2.GetStudentname()<<"& "<<std2.GetStudentMarkEnglish()<<" quot;<<std2.GetStudentMarkMathematics()<<" quot;<<std2.GetStudentMarkComputers()<<"\n";
cout<<std3.GetStudentnumber()<<" quot;<<std3.GetStudentname()<<"& "<<std3.GetStudentMarkEnglish()<<" quot;<<std3.GetStudentMarkMathematics()<<" quot;<<std3.GetStudentMarkComputers();
getch();
return 0;
}





// StudentInformation.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"
#include "conio.h"
#include <iostream>

using namespace std;

class Student{

int studentnumber;
char* studentname;
double markenglish;
double markmathematics;
double markcomputers;

public:

void SetStudentnumber(int studentnumber1){
& studentnumber=studentnumber1;

}

void SetStudentname(char* studentname1){
& & studentname=studentname1;
}
void SetStudentMarkEnglish(double markenglish1){
& & markenglish=markenglish1;
}
void SetStudentMarkMathematics(double markmathematics1){
& & markmathematics=markmathematics1;
}
void SetStudentMarkComputers(double markcomputers1){
& & markcomputers=markcomputers1;
}

int GetStudentnumber(){
& & return studentnumber;
}
char* GetStudentname(){
& & return studentname;
}
double GetStudentMarkEnglish(){
& & return markenglish;
}
double GetStudentMarkMathematics(){
& & return markmathematics;
}

double GetStudentMarkComputers(){
& return& markcomputers;
}

};

int _tmain(int argc, _TCHAR* argv[])
{


Student std1,std2,std3;
std1.SetStudentnumber(1);
std1.SetStudentname("Peter");
std1.SetStudentMarkEnglish(5);
std1.SetStudentMarkMathematics(5);
std1.SetStudentMarkComputers(3);

std2.SetStudentnumber(2);
std2.SetStudentname("Bred");
std2.SetStudentMarkEnglish(5);
std2.SetStudentMarkMathematics(5);
std2.SetStudentMarkComputers(3);

std3.SetStudentnumber(3);
std3.SetStudentname("John");
std3.SetStudentMarkEnglish(5);
std3.SetStudentMarkMathematics(5);
std3.SetStudentMarkComputers(3);

cout<<std1.GetStudentnumber()<<" quot;<<std1.GetStudentname()<<"& "<<std1.GetStudentMarkEnglish()<<" quot;<<std1.GetStudentMarkMathematics()<<" quot;<<std1.GetStudentMarkComputers()<<"\n";
cout<<std2.GetStudentnumber()<<" quot;<<std2.GetStudentname()<<"& "<<std2.GetStudentMarkEnglish()<<" quot;<<std2.GetStudentMarkMathematics()<<" quot;<<std2.GetStudentMarkComputers()<<"\n";
cout<<std3.GetStudentnumber()<<" quot;<<std3.GetStudentname()<<"& "<<std3.GetStudentMarkEnglish()<<" quot;<<std3.GetStudentMarkMathematics()<<" quot;<<std3.GetStudentMarkComputers();
getch();
return 0;
}



Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be first!

Leave a comment

Ask Your question

Submit
Privacy policy Terms and Conditions