The learners must create a C++ program using FUNCTIONS to compute the net salary of the employee based on the status. The program will allow the users to choose the status and using the functions, the program will ask the values needed to compute the net salary. There must be two functions to compute the net salary for Contractual and Regular. Please use contractual and regular as FUNCTION NAMES.
#include <iostream>
#include <string>
using namespace std;
double contractual(double amount){
return amount-amount*0.2;
}
double regular(double amount){
return amount-amount*0.1;
}
int main() {
int status ;
double amount;
double netSalary;
cout<<"1. Contractual\n";
cout<<"2. Regular\n";
cout<<"Your choice: ";
cin>>status ;
cout<<"Enter amount: ";
cin>>amount;
if(status=1){
netSalary=contractual(amount);
}else{
netSalary=regular(amount);
}
cout<<"The net salary: "<<netSalary<<"\n";
system("pause");
return 0;
}
Comments
Leave a comment