object oriented programing basic concept using a simple program
#include <iostream>
#include<conio.h>
using namespace std;
class school
{
public:
float school_width;
float school_height;
int classrooms;
int teachers;
int students;
int sec_per_classes;
int labs;
int school_floors;
int playgrounds;
float school_area();
float school_tax();
double student_total_fee();
double total_income();
double teacher_salaries();
};
float school::school_area()
{
return(school_width*school_height);
}
float school::school_tax()
{
return((school_width*school_height)/5);
}
double school::student_total_fee()
{
return(students*5000);
}
double school::total_income()
{
return(students*5-teachers);
}
double school::teacher_salaries()
{
return(classrooms*teachers);
}
void main()
{
school aps;
cout<<"enter the length of school";
cin>>aps.school_width;
cout<<"enter the height of school";
cin>>aps.school_height;
cout<<"enter the class rooms in school";
cin>>aps.classrooms;
cout<<"enter the teachers in school";
cin>>aps.teachers;
cout<<"enter the students in school";
cin>>aps.students;
cout<<"enter the sec_per_classes in school";
cin>>aps.sec_per_classes;
cout<<"enter the labs in school";
cin>>aps.labs;
cout<<"enter the school_floors in school";
cin>>aps.school_floors;
cout<<"enter the playgrounds in school";
cin>>aps.playgrounds;
cout<<"area is" <<aps.school_area()<<"\n";
cout<<"skul tax is "<<aps.school_tax()<<"\n";
cout<<"fees is " <<aps.student_total_fee()<<"\n";
cout<<"income is" <<aps.total_income();
cout<<"salary is" << aps.teacher_salaries()<<"\n";
getch();
}
#include<conio.h>
using namespace std;
class school
{
public:
float school_width;
float school_height;
int classrooms;
int teachers;
int students;
int sec_per_classes;
int labs;
int school_floors;
int playgrounds;
float school_area();
float school_tax();
double student_total_fee();
double total_income();
double teacher_salaries();
};
float school::school_area()
{
return(school_width*school_height);
}
float school::school_tax()
{
return((school_width*school_height)/5);
}
double school::student_total_fee()
{
return(students*5000);
}
double school::total_income()
{
return(students*5-teachers);
}
double school::teacher_salaries()
{
return(classrooms*teachers);
}
void main()
{
school aps;
cout<<"enter the length of school";
cin>>aps.school_width;
cout<<"enter the height of school";
cin>>aps.school_height;
cout<<"enter the class rooms in school";
cin>>aps.classrooms;
cout<<"enter the teachers in school";
cin>>aps.teachers;
cout<<"enter the students in school";
cin>>aps.students;
cout<<"enter the sec_per_classes in school";
cin>>aps.sec_per_classes;
cout<<"enter the labs in school";
cin>>aps.labs;
cout<<"enter the school_floors in school";
cin>>aps.school_floors;
cout<<"enter the playgrounds in school";
cin>>aps.playgrounds;
cout<<"area is" <<aps.school_area()<<"\n";
cout<<"skul tax is "<<aps.school_tax()<<"\n";
cout<<"fees is " <<aps.student_total_fee()<<"\n";
cout<<"income is" <<aps.total_income();
cout<<"salary is" << aps.teacher_salaries()<<"\n";
getch();
}