Question

In: Electrical Engineering

write a programme named question5a.cpp that calculate and print pay slip

write a programme named question5a.cpp that calculate and print pay slip

Solutions

Expert Solution

Program code:

#include<iostream>

using namespace std;

class Emp

{

int id;

char name[100];

float basicsalary, hra, da, tax, net_salary;

public:

void accept()

{

cout<<"\n Enter Employee Id : ";

cin>>id;

cout<<"\n Enter Employee Name : ";

cin>>name;

cout<<"\n Enter Basic Salary : ";

cin>>basicsalary;

hra = 1000;

da = 0.25 * basicsalary;

tax = 0.15 * basicsalary;

net_salary = basicsalary + da + hra - tax;

}

void disp()

{

cout<<"\n ----------------------- ";

cout<<"\n Employee Id : "<<id;

cout<<"\n Employee Name : "<<name;

cout<<"\n Basic Salary : "<<basicsalary;

cout<<"\n HRA : "<<hra;

cout<<"\n DA : "<<da;

cout<<"\n I-Tax : "<<tax;

cout<<"\n Net Salary : "<<net_salary;

}

};

int main()

{

Emp e;

e.accept();

e.disp();

return 0;

}


Related Solutions

Write a programme to read and print your phone number, your initials and your average. note:c++
Write a programme to read and print your phone number, your initials and your average. note:c++
Write a c++ function named multi_table to print out multiplication table for a given number of...
Write a c++ function named multi_table to print out multiplication table for a given number of rows and columns. Your program should print a header row and a header column to represent each row and column number. For example your function call multi_table(4, 4) would print below to the command line: 1 | 1 2 3 4 _________ 2 | 2 4 6 8 3 | 3 6 9 12 4 | 4 8 12 16 Test your function in...
Exercise 1. Write a function named printBox to print a 5 x 10 box of asterisks...
Exercise 1. Write a function named printBox to print a 5 x 10 box of asterisks using nested loops. When printBox() is called your function should display the pattern shown below. Write a function named printBox to print a 5 x 10 box of asterisks using nested loops. When printBox() is called your function should display the following information. ********** ********** ********** ********** ********** """ # place the code for the printBox function here printBox( numRows, numCols ) Exercise 2....
Write a program named subtract.asm that does the following using LC3 assembly language: Print a prompt...
Write a program named subtract.asm that does the following using LC3 assembly language: Print a prompt "PRESS TWO KEYS: " Note that the prompt MUST LOOK EXACTLY like the above, with a colon and a space after the word KEYS with no newline. Get a two key press from the user. Subtract the second characters ASCII code from the first characters ASCII code. If the result is positive, print the word POSITIVE. Turn in subtract.asm to the appropriate submission point...
Using C++ code, write a program named q5.cpp to print the minimum of the sums x...
Using C++ code, write a program named q5.cpp to print the minimum of the sums x + y^3 and x^3 + y, where x and y are input by a user via the keyboard.
write a program to calculate and print payslips write program that calculates and prints payslips. User...
write a program to calculate and print payslips write program that calculates and prints payslips. User inputs are the name of employee, numbers of hours worked and hourly rate c++ language
Write a C++ program for the following problem: Calculate and print the area and volume of...
Write a C++ program for the following problem: Calculate and print the area and volume of a cone inside a While  loop that goes from 1 to 20 with a step of .5. (the step is 1/2 or Point 5, so you go 10, 10.5,11, 11.5) Note: Your loop variable will need to be a double data type Use two decimal places on all numbers that are double data type. This will be a table with 3 columns. Don't worry about...
Write a program that reads two square Matrices of size 2 *2 and calculate and print...
Write a program that reads two square Matrices of size 2 *2 and calculate and print the sum of them. Also, the signed value of the matrices are input by the user Note: 1) Use CamelCase for variables names 2) Write Comments such as your name, the class, description of the program, and description of your logic. 4) Use sematic names for your variables 5) Your program should be C program not C++.
PL/SQL Write a PL/SQL block, using a While Loop, to calculate and print the sum of...
PL/SQL Write a PL/SQL block, using a While Loop, to calculate and print the sum of the odd integers from 10 to 120 inclusive. (Hint: 11 + 13 + 15 + . . . + 97 + 99)
Design and write a function to calculate a person’s pay for a variable number of hours...
Design and write a function to calculate a person’s pay for a variable number of hours worked. ● Create a constant called HOURLY_RATE set to 24.95 ● To Consider - should this be local to the function or global? ● Ask the user to enter their number of hours worked (do this inside the function). Remember to always use meaningful variable names for variables! ● Then calculate and return their total pay Add code to main which will call this...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT