A manufacturing
company has classified its executives into four levels for the benefit of
certain perks. The level and corresponding perks are shown by Table-1 stated
below. An executive’s gross salary includes basic pay, house rent allowance at
25% of basic pay and other perks. Income tax is withheld from the salary on a
percentage basis, which is explained in the Table-2 stated below. Write a
program that will read and executive’s job number, level number, and basic pay
and then compute the net salary after withholding income tax.
(“সি প্রোগ্রামিং” এর মাধ্যমে একটি নির্মাণ কোম্পানির কর্মচারীদের মোট বেতন তৈরির সোর্সকোড
লিখতে হবে যার শর্তগুলো নিন্মে টেবিল আকারে দেওয়া হয়েছে। প্রোগ্রামটি প্রথমত কোম্পানিতে বর্তমান
নির্বাহীদের চাকুরির আই.ডি.-নং ইউজার এর নিকট থেকে সংগ্রহ করবে এরপর লেভেল-নং এবং সর্বশেষে
মূল বেতন (Basic Salary) নেবে। ইনপুট গুলো নেবার পর আয়কর (income tax)
নিয়ম অনুযায়ী কর্তন করা হবে এবং চূড়ান্ত মোট বেতন (net pay) নির্নয় করবে। কোম্পানির
বেতন দেবার এবং আয়কর কর্তনের নিয়ম নিন্মে টেবিল (Table-1 এবং Table-2) আকারে দেওয়া
হলো ।)
Table-1:
Level
|
Perks
|
|
Conveyance
Allowance
|
Entertainment
Allowance
|
|
1
|
1000
|
500
|
2
|
750
|
200
|
3
|
500
|
100
|
4
|
250
|
0
|
Table-2:
Gross Salary
|
Tax Rate
|
Gross <= 2000
|
No tax deduction
|
2000 < Gross <= 4000
|
3%
|
4000 < Gross <= 5000
|
5%
|
Gross > 5000
|
8%
|
using C++
ReplyDelete#include
using namespace std;
class Base
{
public:
int numOfEmp;
void takeNumOfEmp(int i);
void printIdLvl(int i);
void empDetails();
protected:
int proNumOfEmp;
double transEmpData[20][2];
double basicPay[20];
};
void Base::takeNumOfEmp(int i)
{
proNumOfEmp = numOfEmp = i;
}
void Base::printIdLvl(int i)
{
if (i == 0)
cout << "Enter Employ Id --: ";
else if (i == 1)
cout << "Enter Employ Level --: ";
}
void Base::empDetails()
{
for (int i = 0; i < numOfEmp; i++){
for (int j = 0; j < 2; j++){
printIdLvl(j);
cin >> transEmpData[i][j];
}
}
for (int i = 0; i < numOfEmp; i++){
cout << "Enter Basic Pay For id " << transEmpData[i][0] << " --: ";
cin >> basicPay[i];
}
}
class Derive: public Base
{
public:
double perks[4][2] = {{1000, 500}, {750, 200}, {500, 100}, {250, 0}};
double store[20];
double home[20];
void showBasicPay();
void calculateBill();
void showPay();
};
void Derive::showBasicPay()
{
double sum = 0, give;
for (int i = 0; i < proNumOfEmp; i++){
sum = basicPay[i];
give = sum*0.25;
home[i] = give;
store[i] = (sum-give);
}
}
void Derive::calculateBill()
{
for (int i = 0; i < proNumOfEmp; i++){
double total = 0;
if (store[i] <= 2000){
store[i] = store[i];
}
else if (store[i] <= 4000){
total = store[i]*0.03;
store[i] = store[i]-total;
}
else if (store[i] <= 5000){
total = store[i]*0.05;
store[i] = store[i]-total;
}
else if (store[i] > 5000){
total = store[i]*0.08;
store[i] = store[i]-total;
}
}
}
void Derive::showPay()
{
for (int i = 0; i < proNumOfEmp; i++){
int sum = 0;
if (transEmpData[i][1] == 1){
sum = store[i] + perks[0][0] + perks[0][1] + home[i];
store[i] = sum;
}
else if (transEmpData[i][1] == 2){
sum = store[i] + perks[1][0] + perks[1][1] + home[i];
store[i] = sum;
}
else if (transEmpData[i][1] == 3){
sum = store[i] + perks[2][0] + perks[2][1] + home[i];
store[i] = sum;
}
else if (transEmpData[i][1] == 4){
sum = store[i] + perks[3][0] + perks[3][1] + home[i];
store[i] = sum;
}
}
for (int i = 0; i < proNumOfEmp; i++){
cout << "Total payable bill with out TAX for ID " << transEmpData[i][0] << " --: " << store[i] << endl;
}
}
int main()
{
Derive object;
int numOfEmp;
cout << "Enter how many employ data do you want to Entry --: ";
cin >> numOfEmp;
if (numOfEmp > 20)
cout << "You Can Add Maximum 20 Employs Data --SORRY--.";
else{
object.takeNumOfEmp(numOfEmp);
object.empDetails();
object.showBasicPay();
object.calculateBill();
object.showPay();
}
return 0;
}
/*
Taking input how many employs data want to entry.
Taking Employ ID and LEVEL & store in a array.
Taking basic salary by given ID & store it in another array.
Separate home rent and another allowance from the basic salary for all Employ and storing in another array.
Minus the tax from the bill and reset the array where basic bill stored.
From the given level set the total amount and also adding the home rent and others.
Now showing the total bill by given ID.
*/
#include
ReplyDeleteusing namespace std;
class hamid
{
public:
int num;
void takeNumOfEmp(int i)
{
proNumOfEmp = i;
num = i;
}
void il(int i)
{
if (i == 0)
cout << "Enter Id ";
else if (i == 1)
cout << "Enter Level ";
}
void empDetails()
{
for (int i = 0; i < num; i++){
for (int j = 0; j < 2; j++){
il(j);
cin >> transEmpData[i][j];
}
}
for (int i = 0; i < num; i++){
cout << "Enter bill For id " << transEmpData[i][0] << " ";
cin >> basicPay[i];
}
}
protected:
int proNumOfEmp;
double transEmpData[20][2];
double basicPay[20];
};
class hamidTwo: public hamid
{
public:
double perks[4][2] = {{1000, 500}, {750, 200}, {500, 100}, {250, 0}};
double store[20];
double home[20];
void showBasicPay()
{
double sum = 0, give;
for (int i = 0; i < proNumOfEmp; i++){
sum = basicPay[i];
give = sum*0.25;
home[i] = give;
store[i] = (sum-give);
}
}
void tax()
{
for (int i = 0; i < proNumOfEmp; i++){
double total = 0;
if (store[i] <= 2000){
store[i] = store[i];
}
else if (store[i] <= 4000){
total = store[i]*0.03;
store[i] = store[i]-total;
}
else if (store[i] <= 5000){
total = store[i]*0.05;
store[i] = store[i]-total;
}
else if (store[i] > 5000){
total = store[i]*0.08;
store[i] = store[i]-total;
}
}
}
void showPay()
{
for (int i = 0; i < proNumOfEmp; i++){
int sum = 0;
if (transEmpData[i][1] == 1){
sum = store[i] + perks[0][0] + perks[0][1] + home[i];
store[i] = sum;
}
else if (transEmpData[i][1] == 2){
sum = store[i] + perks[1][0] + perks[1][1] + home[i];
store[i] = sum;
}
else if (transEmpData[i][1] == 3){
sum = store[i] + perks[2][0] + perks[2][1] + home[i];
store[i] = sum;
}
else if (transEmpData[i][1] == 4){
sum = store[i] + perks[3][0] + perks[3][1] + home[i];
store[i] = sum;
}
}
for (int i = 0; i < proNumOfEmp; i++){
cout << "Total payable bill " << store[i] << endl;
}
}
};
int main()
{
hamidTwo object;
int i;
cout << "Enter how many employ data want to Entry ";
cin >> i;
object.takeNumOfEmp(i);
object.empDetails();
object.showBasicPay();
object.tax();
object.showPay();
return 0;
}
ID : 201620195
ReplyDeletehttps://www.dropbox.com/s/303dg5ltcvg6ovb/02.cpp?dl=0
ID:201520552
ReplyDeletehttps://www.dropbox.com/s/303dg5ltcvg6ovb/02.cpp?dl=0
ID:201610456
ReplyDeletesalary calculation using polymorphism
link->
https://ideone.com/ER0asx
ID 201610456
ReplyDeletesalary calculation applying the concept of polymorphism
Link->
https://drive.google.com/open?id=0B_PIGnOMR0K2bzFzS0ZYZTNxMEk
ID:201610245
ReplyDelete#include
using namespace std;
class salary
{ public:
void table()
{
cout<<"Executive’s job number:";
cin>>id;
cout<<"Level number:";
cin>>level;
cout<<"Basic salary:";
cin>>basic_salary;
house_rent=basic_salary*.25;
gross_salary=basic_salary-house_rent;
float flag=0;
if(gross_salary <= 2000)
{
gross_salary;
}
else if(2000 < gross_salary && gross_salary <= 4000)
{
flag=gross_salary*0.03;
gross_salary-=flag;
}
else if(4000 < gross_salary && gross_salary <= 5000)
{
flag=gross_salary*0.05;
gross_salary-=flag;
}
else if (gross_salary > 5000)
{
flag=gross_salary*0.08;
gross_salary-=flag;
}
}
protected:
int id,level;
float basic_salary,gross_salary,house_rent;
};
class salary_calculation : public salary
{
public:
void table()
{
cout<<"Basic salary without tax:";
if(level == 1)
cout<<1000+500+gross_salary+house_rent;
else if(level == 2)
cout<<750+200+gross_salary+house_rent;
else if(level == 3)
cout<<500+100+gross_salary+house_rent;
else if(level == 4)
cout<<250+0+gross_salary+house_rent;
else
cout<<"Level is not valid";
}
};
int main()
{
salary *p;
salary_calculation obj;
p=&obj;
p->table();
obj.table();
return 0;
}
/******************
ReplyDelete* Khorshed Alam *
* CSE-56th *
* ID: 201730438 *
******************/
#include <iostream>
using namespace std;
class prepare
{
public:
int conveyance[5] = {0,1000, 750, 500, 250};
int entertainment[5] = {0, 500, 200, 100, 0};
int tex;
int total;
int net;
int calculate(int id, int lavel, int gross)
{
switch(lavel)
{
case 1:
total = gross+conveyance[1]+entertainment[1];
cout<<"Conveyance Allowance : "<>id;
cout<<"Input Lavel (1-4): ";
cin>>lavel;
cout<<"Input Gross Salary: ";
cin>>gross;
}
int e_id()
{
return id;
}
int e_lavel()
{
return lavel;
}
int e_gross()
{
return gross;
}
void reset()
{
id = 0;
lavel = 0;
gross = 0;
tex = 0;
total = 0;
net = 0;
}
};
int main()
{
int id, lavel, gross;
char process;
salery s;
newEmploye:
s.getdata();
cout<<"Net payable salery = "<>process;
if(process == 'Y' || process == 'y')
{
s.reset();
cout<<"\n";
goto newEmploye;
}
else if (process == 'N' || process == 'n')
{
cout<<"Press any button to exit";
}
else
{
cout<<"Wrong input. Please input Y/N ";
goto desition;
}
}
-----------------------
ReplyDeleteFazle Rabbi Khan Taron
ID :201720263
Batch :55th
-----------------------
#include
#include
#define SIZE 5
class emp
{
float basic,da,it,netsal;
char name[20],num[10];
public:
void getdata();
void net_sal();
void dispdata();
};
void emp::getdata()
{
cout<<"\n Enter number: " ;
cin>>name;
cout<<" Enter name: " ;
cin>>num;
cout<<"Enter basic salary in Rs: " ;
cin>>basic;
}
void emp::net_sal()
{
da=((0.52)*basic );
float gsal=da+basic;
it=((0.3)*gsal);
netsal=gsal-it;
}
void emp::dispdata()
{
cout
<<"\n number: "<>n;
for(int i=0;i<n;i++)
{
ob[i].getdata();
ob[i].net_sal();
}
clrscr();
cout<<"\n-----------------"
<<"\nDetail::"
<<"\n-----------------";
for( i=0;i<n;i++)
{
cout<<"\n\n :"<<i+1
<<"\n ----------";
ob[i].dispdata();
}
getch();
}
/*******************************
ReplyDeleteForhad Parvez
CSE
201720297
55th
********************************/
#include
using namespace std;
class firstone{
public:
int a;
void scanfunc(){
cout<<"Enter Number Of Element : ";
cin>>a;
}
};
class secondone: public firstone{
public:
int i=1, b,sum=0;
int scanalldata(){
for(i; i<=a; i++) {
cout<<"Enter Value "<>b;
sum+=b;
}
return sum;
}
};
class thirdone: public secondone{
public:
void banner(){
cout<<"Print total summation of all the numbers."<<endl;
}
};
int main()
{
int total;
thirdone myobj;
myobj.banner();
myobj.scanfunc();
total=myobj.scanalldata();
cout<<"Sum : "<< total;
return 0;
}
//Yousuf Ahmmed
ReplyDelete//Batch: 56th
//Roll: 201730047
#include
using namespace std;
class prepare
{
public:
int conveyance[5] = {0,1000, 750, 500, 250};
int entertainment[5] = {0, 500, 200, 100, 0};
int tex;
int total;
int net;
int calculate(int id, int lavel, int gross)
{
switch(lavel)
{
case 1:
total = gross+conveyance[1]+entertainment[1];
cout<<"Conveyance Allowance : "<>id;
cout<<"Input Lavel (1-4): ";
cin>>lavel;
cout<<"Input Gross Salary: ";
cin>>gross;
}
int e_id()
{
return id;
}
int e_lavel()
{
return lavel;
}
int e_gross()
{
return gross;
}
void reset()
{
id = 0;
lavel = 0;
gross = 0;
tex = 0;
total = 0;
net = 0;
}
};
int main()
{
int id, lavel, gross;
char process;
salery s;
newEmploye:
s.getdata();
cout<<"Net payable salery = "<>process;
if(process == 'Y' || process == 'y')
{
s.reset();
cout<<"\n";
goto newEmploye;
}
else if (process == 'N' || process == 'n')
{
cout<<"Press any button to exit";
}
else
{
cout<<"Wrong input. Please input Y/N ";
goto desition;
}
}
/*Ariful Islam
ReplyDeleteID: 201730750
AUB CSE 56th Batch*/
#include
using namespace std;
class prepare
{
public:
int conveyance[5] = {0,1000, 750, 500, 250};
int entertainment[5] = {0, 500, 200, 100, 0};
int tex;
int total;
int net;
int calculate(int id, int level, int gross)
{
switch(level)
{
case 1:
total = gross+conveyance[1]+entertainment[1];
cout<<"Conveyance Allowance : "<>id;
cout<<"Input Lavel (1-4): ";
cin>>level;
cout<<"Input Gross Salary: ";
cin>>gross;
}
int e_id()
{
return id;
}
int e_level()
{
return level;
}
int e_gross()
{
return gross;
}
void reset()
{
id = 0;
level = 0;
gross = 0;
tex = 0;
total = 0;
net = 0;
}
};
int main()
{
int id, level, gross;
char process;
salery sal;
newEmploye:
sal.getdata();
cout<<"Net payable salery = "<>process;
if(process == 'Y' || process == 'y')
{
sal.reset();
cout<<"\n";
goto newEmploye;
}
else if (process == 'N' || process == 'n')
{
cout<<"Press any button to exit";
}
else
{
cout<<"Wrong input. Please input Y/N ";
goto desition;
}
}
Al Hasan
ReplyDeleteID:201730011
CSE: 56th
************
#include
using namespace std;
class counter
{
public:
int a = 0;
int number(int x)
{
while(x>0)
{
x = x/10;
a++;
}
return a;
}
};
class math:public counter
{
public:
int x;
int getval()
{
cout<<"Input a number to calculate digit ";
cin>>x;
return x;
}
};
int main()
{
math m;
int x = m.getval();
cout<<"This number contains = "<<m.number(x)<<" digits";
}
PHP Getting Document of Remote Address
ReplyDeletePHP Logging Errors Into a File
PHP SplFileObject Standard Library
PHP7 Sodium Encryption Decryption
PHP7 Password Hashing
PHP7.3 New Features
PHP Get Visitor Information
PHP secure random password
PHP Graphics