Computer Programming Assignment: Seat Allocation and Salary Calculation, Assignments of Programming Languages

The document provides C++ Programming task fr an assignment showing concepts such as objects, classes, constructors, destructors,

Typology: Assignments

2020/2021

Uploaded on 08/30/2021

patrick-mwangi
patrick-mwangi 🇰🇪

1 document

1 / 4

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
pf3
pf4

Partial preview of the text

Download Computer Programming Assignment: Seat Allocation and Salary Calculation and more Assignments Programming Languages in PDF only on Docsity!

COMPUTER PROGRAMMING ASSIGNMENT

Number one #include using namespace std; //void choice(); //void menu(); int main(){ int d; int business[4] = {1,2,3,4}; int economy[4] = {5,6,7,8}; int y=0;int add;int x=0;int add2; do{ cout<<"Enter your class "<<endl; cout<<"1.Business class "<<endl; cout<<"2.Economy class "<<endl; cin>>d; switch(d){ case 1: for(int i=y;i<=3;i++){ if(add==y){ break; } cout<<"Your have been assigned Seat No: "<<business[i]<<endl; cout<<"Section: Business Class"<<endl;

business[i] = 4; y++; add = y; } ;break; case 2: for(int i=x;i<=3;i++){ if(add2==x){ break; } cout<<"Your have been assigned seat "<<economy[i]<<endl; cout<<"Section: Economy Class"<<endl; economy[i] = 4; x++; add2 = x; } break; default:cout<<"CHOOSE CORRECT CLASS"<<endl; } add = 16; add2 =16; }while((business[3])!=4 || (economy[3])!=4); return 0; }

Tax_amount=tax_rate(basic_salary+allowance)/100; Net_salary= basic_salary+Tax_amount; } void salary::Salary_display() { cout<<"Basic Salary is: "<<basic_salary<<endl; cout<<"Tax Rate is: "<<tax_rate<<endl; cout<<"That tax amount is: "<<Tax_amount<<endl; cout<<"Your Net Salary is: "<<Net_salary<<endl; } int main() { salary worker; worker.Salary_input();//take input worker.Salary_computations();//make calculations worker.Salary_display();//display output return 0; }*