Professional Documents
Culture Documents
#include<iostream>
using namespace std;
class Person {
public:
string name;
int year_of_birth;
Person(string n, int y) {
name = n;
year_of_birth = y;
}
};
class Employee {
public:
int employeeID, joiningYear, courseID;
string jobTitle, courseTitle;
};
};
int main() {
OUTPUT
PRACTICE TASK 2
#include<iostream>
using namespace std;
class Employee
{
protected:
int empid;
string empname;
public:
Employee(int id, string emp_name)
{
empname = emp_name;
empid = id;
}
};
class HourlyEmployee : public Employee
{
public:
int hourlyIncome;
public:
HourlyEmployee(int hour, int id, string emp_name) : Employee(id, emp_name)
{
hourlyIncome = hour;
}
void calculate_hourly_income()
{
cout << "Income of Hourly Employee is : " << hourlyIncome * 150 << endl;
void Display()
{
cout << "Hourly Employee ID : " << empid << endl;
cout << "Hourly Employee Name : " << empname << endl;
}
};
public:
PermanentEmployee(int hour, int id, string emp_name) : Employee(id, emp_name)
{
hourlyIncome = hour;
}
void income()
{
cout << "Income of Permanent Employee is : " << (hourlyIncome * 150) + 240 <<
endl;
void Display()
{
cout << "Permanent Employee ID : " << empid << endl;
cout << "Permanent Employee Name : " << empname << endl;
};
int main()
{
HourlyEmployee h(20, 564, "Hasan");
PermanentEmployee p(25, 670, "Hussain");
h.Display();
h.calculate_hourly_income();
p.Display();
p.income();
OUTPUT
PRACTICE TASK 3
#include <iostream>
class BankAccount {
private:
int accountID;
int balance;
public:
int getAccountId() {
return accountID;
}
void setBalance(int balance) {
this->balance = balance;
}
int balanceInquiry() {
return balance;
}
};
public:
public:
};
int main()
{
return 0;
}
OUTPUT