Question
Define a C++ class, named student, with the following specifications Private members of class student -admno: integer -sname: character array is size 20 -eng: real
Define a C++ class, named student, with the following specifications
Private members of class student
-admno: integer
-sname: character array is size 20
-eng: real
-math: real
-science: real
-total: real
-ctotal(): a function that returns the sum of eng, math and science
Public member function of class student
-inputData(): Accepts values for admno, sname, eng, science, interactively, and invokes ctotal() to set total.
-printData(): Displays all the data members, descriptively
#include
#include
#include
using namespace std;
//Place your class definition here
int main () //This is your main driver. Do NOT make any changes to it
{
student obj ;
obj.inputData();
obj.printData();
return 0;
}
//Place your class member function definitions here
Your output correctly ends with
1: output1
Input
12569
Kyle Smith
98
76
67
Your output correctly ends with
Admission number: 12569
Student name: Kyle Smith
English: 98
Math: 76
Science: 67
Total: 241
2: output2keyboard_arrow_up
0 / 15
Output differs. See highlights below.
Input
5398
Mary Quille
100
-30
70
Your output ends with
scores for your courses...
English: 98
Math: 76
Science: 67
Admission number: 12569
Student name:Kyle Smith
English: 98
Math: 76
Science: 67
Total: 241
Expected output ends with
Admission number: 5398
Student name: Mary Quille
English: 100
Math: -30
Science: 70
Total: 140
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started