Answer to Question #309595 in C++ for Rain Capisonda

Question #309595

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.

1
Expert's answer
2022-03-11T07:24:10-0500


#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;
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment