Programming

# Program that Displays the Monthly Salary

Write a Program that displays the current monthly salary of chief executive officer, information officer, system analyst and programmer that has been increased by 9, 10,12 and 12% respectively in year 2014. Let us assume that the salary in year 2013 are

• CEO=Rs 35,000 per month
• Information Officer=Rs 25,000 per month
• System Analyst=Rs 24,000 per month
• Programmer =Rs 18000 per month

Make function that takes arguments one salary and other increment use proper default arguments.

## Algorithm

1. Start
2. Define an array salary[4] to store the salary of the posts in the year 2013.
3. Define a function new_salary[float sal(i),int inc=0.12] with default value for increment as .12.
4. Calculate the new salaries by passing the salary of the old year and the increment rate to the function using the function new salary[sal(i),inc] and print them.
5. End of program
6. Float new_salary(int sal(i),float inc=0.12)

## Source Code

#include<iostream.h>
#include<conio.h>
#include<iomanip.h>
float new_sal(float sal, float inc=0.12);
void main()
{
float sal0=35000,sal1=25000,sal2=24000,sal3=18000;
cout<<"Salary in the year 2013 per month:"<<endl
<<setw(24)<<"Chief executive officer:"<<sal0<<endl
<<setw(24)<<"Information officer:"<<sal1<<endl
<<setw(24)<<"System analyst:"<<sal2<<endl
<<setw(24)<<"Programmer:"<<sal3<<endl;

sal0=new_sal(sal0, 0.09);
sal1=new_sal(sal1, 0.10);
sal2=new_sal(sal2);
sal3=new_sal(sal3);
cout<<endl<<"Salary in the year 2014 per month:"<<endl
<<setw(24)<<"Chief executive officer:"<<sal0<<endl
<<setw(24)<<"Information officer:"<<sal1<<endl
<<setw(24)<<"System analyst:"<<sal2<<endl
<<setw(24)<<"Programmer:"<<sal3<<endl;
getch();
}

float new_sal(float sal, float inc)
{
return(sal+(sal*inc));
}

#### Tuts

Tutsmaster.org provides tutorials related to tech and programmings. We are also setting up a community for the users and students.

## You may also like

Programming

Programming

#### Calculate the Factorial by Using Recursion

• January 26, 2016