Professional Documents
Culture Documents
ID:22000007
Mechatronics and Industrial
Instrumentation
Code 1
#include <iostream>
#include <string>
using namespace std;
string CustomerName;
int CustomerAge;
int CustomerAccNum;
}
}
void showhumanresource() { // function to show customer details for customer
details
cout << "Customer Name : " << CustomerName << endl;
cout << "Customer Age : " << CustomerAge << endl;
cout << "Customer Account Number : " << CustomerAccNum << endl;
}
};
class FinanceDepartment { // class for finance department
public :
float CustomerSalary;
int CustomerIncomeTax;
public:
float NetSalary ;
void findnetsalary() {// funtion to calculate net salary
NetSalary = CustomerSalary * (CustomerIncomeTax /100) ;
cout << "Customer Net Salary is : " << NetSalary << endl;
}
};
int main()
{
HumanResourceDepartment HR; // creating object from human resource
department class
FinanceDepartment FD ;// creating object from finance department class
PayrollDepartment PD ;// creating object from payroll department class
HR.gethumanresource();
HR.showhumanresource();
FD.getfinance();
FD.showfinance();
PD.findnetsalary();
return 0;
}
Code 2
#include <iostream>
#include<string>
#include<fstream>
#include<vector>
#include<map>
#include<iterator>
int main()
{
cout << "The word that appears most is : " << MaxWord << endl;
cout << MaxWord << " appears : " << NumWords << " times"<< endl;
cout << "Number of characters : " << MaxWord << " has " <<
MaxWord.length() << " characters" << endl;
for (int i = 0;i < MaxWord.length();i++)// converts lowwer case letters to
upper case letters
{
MaxWord[i] = toupper(MaxWord[i]);
}
cout << "Word in ALL CAPS : " << MaxWord << endl;
cout << "Total number of words in the file : " << FileContents.size() <<
endl;
return 0;