Write a program segment to calculate and display the total yearly income of an employee which is calculated from his total salary and annual bonus. The user will be asked to enter the employee's monthly salary and year of service. The employee's year of service will determine the bonus he receives.
#include <iostream>
using namespace std;
int main()
{
int bonus = 5000; // any value can be put here
double month;
int n;
cout<< "Enter year of service\n";
cin>>n;
cout<<"Enter monthly salary\n";
cin>> month;
double total;
total = 12 * month + (bonus * n);
cout<<"The total yearly income: " <<total;
return 0;
}
Comments
Leave a comment