C++ is a middle level programming language developed by Bjarne Stroustrup in 1978-79 at Bell's lab in Murrray Hill. New Jersey, as an enhancement to the C programming language and originally named as "C with classes" but it was renamed C++ in 1983. C++/Cpp language fully support object oriented programming. C++ is statistically hyped compiled, general purpose, case sensitive, free-form programming language that support procedural, object oriented & generic programming.Â
Standard C++ consists of 3 important parts:-
- * The core language giving all the building blocks
including variables, datatypes and literals.
- * The C++ standard library giving a rich set of
function manipulating files, strings etc.
- * The Standard
Template Library (STL) giving a rich set of method manipulating data
structure.
- ->For Designing Operating Systems
- ->C++ has its application in Banking systems
- ->It is used for Cloud/Distributed Systems
- ->Browsers
- ->Libraries
- ->Graphics
- ->Used in Databases
- ->Embedded Systems
- ->Telephone Switches
- ->Compilers
Focusing on the importance and the need of Cpp/C++ language Help for coders provides a completely free online C++ programming tutorial for beginners so that they should get an idea what's the best way to learn Cpp, as this language has a lot of syntax stuffs we provide multiple examples on each and every topic of C++/Cpp programming. We also have our own online compiler for fast and accurate compiling and executions of C++ programs so that everyone learning here should get a complete experience of learning C++ coding and their implementation and practice at same place. Our C++ programming tutorial actually targets C++ programming tutorial for beginners for building a better foundation.
Write a C++ program using a class employee to store the employee_code, surname, forename, and basic pay. The following deductions should also be included: income tax at 20% of Basic Pay and a fixed rate of $10.00 for social security, while the following allowances (not taxable) should be included: housing allowance = $650.00, and motor vehicle allowance = $100.00. Use the functions get ( ), calculate ( ) and display ( ) to perform the following functions: (15 Marks) a) Accept the employee_code, surname, forename, and basic pay. b) Calculate the Net Salary = (Basic Pay - Deductions ) + Allowances c) Display the Net Salary
ReplyDelete// Write a C++ program using a class employee to store the employee_code, surname, forename, and basic pay. The following deductions should also be included: income tax at 20% of Basic Pay and a fixed rate of $10.00 for social security, while the following allowances (not taxable) should be included: housing allowance = $650.00, and motor vehicle allowance = $100.00. Use the functions get ( ), calculate ( ) and display ( ) to perform the following functions: (15 Marks) a) Accept the employee_code, surname, forename, and basic pay. b) Calculate the Net Salary = (Basic Pay - Deductions ) + Allowances c) Display the Net Salary
Delete#include
using namespace std;
class Employee
{
private:
int employee_code;
string surname;
string forename;
float basic_pay;
float deductions;
float allowances;
float net_salary;
public:
void get()
{
cout << "Enter the employee code: ";
cin >> employee_code;
cout << "Enter the surname: ";
cin >> surname;
cout << "Enter the forename: ";
cin >> forename;
cout << "Enter the basic pay: ";
cin >> basic_pay;
}
void calculate()
{
deductions = basic_pay * 0.2;
allowances = 650.00 + 100.00;
net_salary = (basic_pay - deductions) + allowances;
}
void display()
{
cout << "Employee code: " << employee_code << endl;
cout << "Surname: " << surname << endl;
cout << "Forename: " << forename << endl;
cout << "Basic pay: " << basic_pay << endl;
cout << "Deductions: " << deductions << endl;
cout << "Allowances: " << allowances << endl;
cout << "Net salary: " << net_salary << endl;
}
};
int main()
{
Employee employee;
employee.get();
employee.calculate();
employee.display();
return 0;
}
thanks
ReplyDeletePost a Comment
FOR ANY DOUBTS AND ERRORS FEEL FREE TO ASK. YOUR DOUBTS WILL BE ADDRESSED ASAP