Question

In: Computer Science

Write a C program for this:ABC company decides to raise the salaries of its employees according...

  1. Write a C program for this:ABC company decides to raise the salaries of its employees according to the following table:

employee_status         years_of_service                    percent_raise             

                  Full-time                   less than 5 years                        4.0

                  Full-time                   5 years or more                           5.0

                  Part-time                   less than 5 years                         2.5

                  Part-time                   5 years or more                           3.0

If employee_status value is ‘F’, the employee is full-time; if it is ‘P’, he or she is a part-time employee. Write a nested if statement that computes the new salary of the employee given his or her employee_status, years_of_service and salary.

Solutions

Expert Solution

C code:

#include<stdio.h>

int main(){
char employee_status;
float salary;
int year_of_service;

printf("Please enter employee status (F or P): ");
scanf("%c",&employee_status);

printf("Please enter salary of the employee: ");
scanf("%f",&salary);

printf("Please enter the years of service of the employee( in years ): ");
scanf("%d",&year_of_service);

if(employee_status == 'F'){ //If employee status is full time
if (year_of_service < 5){
salary = salary*1.04; //4 % raise
}
else{
salary = salary*1.05; //5 % raise
}
}
else{
if (year_of_service < 5){
salary = salary*1.025; //2.5 % raise
}
else{
salary = salary*1.03; //3 % raise
}
}
printf("The increase salary of employee is now: %.2f",salary);
return 0;
}

Output:


Related Solutions

Write a C++ program that uses array to store the salaries of 10 employees working in...
Write a C++ program that uses array to store the salaries of 10 employees working in a small firm. The program should take average of the salaries and the max and min salaries being paid to the employees
Write a C++ program: The local taqueria has decided they need to raise their prices. In...
Write a C++ program: The local taqueria has decided they need to raise their prices. In order to soften the blow to their customers, they also want to rename all their burritos to make them sound more desirable. Your program should create two arrays in main() - one string array with 3 burrito types and one float array with 3 associated prices, defined below: string names[] = {"Carnitas", "Pollo", "Veggie"}; float prices[] = {6.95, 6.25, 5.95}; Now, main should declare...
The Company collected a sample of the salaries of its employees. There are 70 salary data...
The Company collected a sample of the salaries of its employees. There are 70 salary data points summarized in the frequency distribution below: Salary Number of Employees 5,001–10,000 8 10,001–15,000 12 15,001–20,000 20 20,001–25,000 17 25,001–30,000 13 Find the standard deviation. Find the variance.
Write a C++ program that prints the insurance fee to pay for apet according to...
Write a C++ program that prints the insurance fee to pay for a pet according to the following rules:(NOTE:You must use a switch statement to determine pet fee.)A dog that has been neutered costs $50.A dog that has not been neutered costs $80.A cat that has been spayedcosts $40.A cat that has not been spayedcosts $60.A bird or reptile costs nothing.Any other animal generates an error message.The program should prompt the user for the appropriate information: a character code for...
Write a program in C to process weekly employee timecards for all employees of an organization...
Write a program in C to process weekly employee timecards for all employees of an organization (ask the user number of employees in the start of the program). Each employee will have three data items: an identification number, the hourly wage rate, and the number of hours worked during a given week.A tax amount of 3.625% of gross salary will be deducted. The program output should show the identification number and net pay. Display the total payroll and the average...
C++ Write a whole program to read 50 salaries from the file “Salaries.txt” and print them...
C++ Write a whole program to read 50 salaries from the file “Salaries.txt” and print them on the screen (each value on a separate line), you have to also save the grades (each value on a separate line) into another file “SalariesWithBonus.txt” after you add a bonus of two percent to each salary (example For the salary 100000 a bonus of 2000 will be added as 100000 X 0.02 = 2000). Your code should check whether the file “Salaries.txt” opened...
Program Requirements: Write a C++ program according to the following requirements: 1.   Open the data file...
Program Requirements: Write a C++ program according to the following requirements: 1.   Open the data file Electricity.txt and read each column into an array (8 arrays total). 2.   Also create 2 arrays for the following: Total Fossil Fuel Energy (sum of all fossil fuels) Total Renewable Energy (sum of all renewable sources) Electricity.txt: Net generation United States all sectors monthly https://www.eia.gov/electricity/data/browser/ Source: U.S. Energy Information Administration All values in thousands of megawatthours Year   all fuels   coal       natural gas   nuclear  ...
Owen Company forgot to accrue $3,000 of salaries its employees had earned at the end of...
Owen Company forgot to accrue $3,000 of salaries its employees had earned at the end of 2019. It paid and expensed the salaries in 2020. It also, in 2019, recorded $4,000 of sales as an account receivable; however, the sale really did not take place until 2020, and it should have recognized the revenue in 2020. It collected the money from the sale early in 2020. Provide the impact of the errors on the following: Assets as of 12/31/19: $_____________...
Write a program In C to compute internet charges according to a rate schedule. The rate...
Write a program In C to compute internet charges according to a rate schedule. The rate schedule is as follows: $0.08 per GB for usage between 0 and 40 GB, inclusive $0.07 per GB for usage between 41 GB and 70 GB, inclusive $0.05 per GB for usage between 71 GB and 110 GB, inclusive $0.04 per GB for usage greater than 110 GB Learning Objectives In this assignment, you will: Use a selection control structure Use a repetition control...
Subject is C++ Write a program to compute internet charges according to a rate schedule. The...
Subject is C++ Write a program to compute internet charges according to a rate schedule. The rate schedule is as follows: $0.08 per GB for usage between 0 and 40 GB, inclusive $0.07 per GB for usage between 41 GB and 70 GB, inclusive $0.05 per GB for usage between 71 GB and 110 GB, inclusive $0.04 per GB for usage greater than 110 GB code must use these four functions, using these names (in addition to main): getData computeCharges...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT