Answer to Question #44087 in C++ for paula

Question #44087
1. define a structure employee with name, category , salary, tax as a member. read the name category and salary of employee and calculate the tax as below

categories
A 10% OF SALARY
B 15% OF SALARY
C 20% OF SALARY
OTHERS 30% OF SALARY


2.firstly write a program to accept the number of telephone calls made by a customer and the print out the rate in cents.
1
Expert's answer
2014-07-10T08:47:48-0400
#include <iostream>
typedef struct {
std::string name;
char category;
double salary;
double tax;
void getTax () {
if (category == 'A') {
tax = 0.1;
} else if ( category == 'B' ) {
tax = 0.15;
} else if ( category == 'B' ) {
tax = 0.2;
} else {
tax = 0.3;
}
}
double calculateSalary () {
return salary - (salary * tax);
}
} Employee;
int main() {
Employee Eric = new Employee();
sts::cout << "Enter name, category and salary for employee" << std::endl;
std::cin >> Eric.name >> Eric.category >> Eric.salary;
Eric.getTax();
Eric.salary = Eric.calculateSalary();
std::cout << Eric.name << "'s salary is " << Eric.salary << std::endl;
delete Eric;
return 0;
}

#include <iostream>
int main() {
int minutes;
std::cout << "Enter total minutes talked" << std::endl;
std::cin >> minutes;
std::cout << "You owe us " << minutes << " cents" << std::endl;
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

Assignment Expert
14.08.14, 15:26

Dear visitor, please use panel for submitting new questions

Layziebone
13.08.14, 12:59

Can you write this program in C programming and not C++? 1. define a structure employee with name, category , salary, tax as a member. read the name category and salary of employee and calculate the tax as below categories A 10% OF SALARY B 15% OF SALARY C 20% OF SALARY OTHERS 30% OF SALARY 2.firstly write a program to accept the number of telephone calls made by a customer and the print out the rate in cents.

Leave a comment

LATEST TUTORIALS
APPROVED BY CLIENTS