18CS306 - Programming Using CPP - 191CS456 - Task1

You might also like

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 12

OUTCOME

BASED LAB
TASK REPORT

1
TITLE OF THE TASK

Data Maintenance System in an Educational Institution

OUTCOME BASED LAB TASK REPORT

Submitted by

ANOOSKAVIN G

NAME OF THE CANDIDATE

ANOOSKAVIN G

1
BANNARI AMMAN INSTITUTE OF TECHNOLOGY
(An Autonomous Institution Affiliated to Anna University, Chennai)
SATHYAMANGALAM-638401

OCTOBER 2020

DECLARATION

I affirm that the lab task work titled “Data Maintenance System in an
Educational Institution” being submitted as the record of original work done by us under
the guidance of Ms RAMYA R NAME OF THE SUBJECT HANDLING FACULTY,
Designation, Department of COMPUTER SCIENCE AND ENGINEERING.

ANOOSKAVIN G
191CS119

I certify that the declaration made above by the candidates is true.

(Signature of the Guide)


RAMYA R

3
TABLE OF CONTENTS

CHAPTER NO. PAGE NO.


TITLE

1. INTRODUCTION 5

2. DESCRIPTION OF THE TASK 5


6
ALGORITHM OF THE TASK
3.
7
4
FLOWCHART
9
5
PROGRAM

6 OUTPUT 11

7 RESULT 12
12
8
CONCLUSION

4
INTRODUCTION
The ultimate use of c++ language is their OOPS concepts as their class
and objects are useful in creating the complex task as in this report, Let we
obtain the above data maintenance using these above concepts.

DESCRIPTION OF THE TASK


• The main aim of the task is to store the student and professor records by
using Object Oriented Programming.
• Keeping the User as the base class and student, professor as the derived class
it can be achieved
Terminology to be known:
CLASS: A class in C++ is a user-defined type or data structure declared
with keyword class that has data and functions (also called member
variables and member functions) as its members whose access is governed
by the three access specifiers private, protected or public.

OBJECT: An object is an instance of a class, in our case d is an instance of


the class date. It is the same as variable with all the functionality specified in
the class’s definition. The class date is just the definition, which does not
allocate memory.

INHERITANCE: Inheritance is a process in which one object acquires all


the properties and behaviours of its parent object automatically. In such way,
you can reuse, extend or modify the attributes and behaviours which are
defined in other class.

ARRAY AS OBJECTS: The array of type class contains the objects of the
class as its individual elements. Thus, an array of a class type is also known
as an array of objects.

5
ALGORITHM OF THE TASK
1. Create a base class as person with name and age as data members

2. Create professor class with publication and cur_id (static) as data


members, putdata () and getdata () as the member function to get and
print their details

3. Create student class with marks (array) and cur_id (static) as data
members, putdata () and getdata () as the member function to get and
print their details

4. The professor and student should be inherited from the person class
with hierarchical inheritance concept

5. In the main function get the no of records to be inserted from the user
and assign the object value by using the array as object method

6. Construct the for loop with inside a if condition so when the user
enter 1 it points to enter professor record and 2 to student record

7. Finally, again using the for loop print the values back which we have
got from the user.

6
FLOW CHART

PERSON

String Name

Int age

PROFESSOR STUDENT

Int Publications Int Marks [6]

Static int Cur_id Static int Cur_id

Getdata() Getdata ()

Putdata () Putdata ()

7
start

Get no of records
to be inserted

Allocating the objects for the


class

1 2

Choice

Get the professor


data Get the student data

Print the
records
PROGRAM
#include <iostream>
using namespace std;
#define MAX 30
class student
{
private:
char name[30];
int age;
int marks[5];
int total;
public:
void getdata(void);
void putdata(void);
};
class professor
{
private:
char name[30];
int age;
int publications;

public:

void getdata(void);
void putdata(void);
};
void professor::getdata(void){
cin >> name>> age>> publications;
}
void professor::putdata(void){
cout << name << " " << age << " " << publications;
}
void student::getdata(void){
cin >> name>> age>> marks[0]>> marks[1]>> marks[2]>> marks[3]>> marks[4]
>> marks[5];
total=s1+s2+s3+s4+s5+s6;
}

void student::putdata(void){
cout << name<<" "<< age<<" " << total ;

int main()
{
student std[MAX];
9
professor prof[MAX];
int n,loop,obj,j=1,a[MAX],b=1;

cin >> n;
for(loop=0;loop< n; loop++){
cin>>obj;
if(obj==2)
{
std[loop].getdata();
a[loop]=obj;
}
else
{
prof[loop].getdata();
a[loop]=obj;
}
}
cout << endl;
for(loop=0;loop< n; loop++){
if(a[loop]==2)
{
std[loop].putdata();
cout<<" "<<j<<"\n";
j=j+1;
}
else
{
prof[loop].putdata();
cout<<" "<<b<<"\n";
b=b+1;
}
}
return 0;
}

10
OUTPUT

11
RESULT
Hence by using the oops concepts in the c++ the above program
was executed successfully

CONCLUSION
The final aim of the program to collect and store the professor and student
details achieved by use of the c++ oops concepts and was executed successfully.

12

You might also like