Write the program with at least two functions to solve the
following problem. The members of the board of a small
university are considering voting for a pay increase for
their 5 faculty members. They are considering a pay
increase of 8%. Write a program that will prompt for and
accept the current salary for each of the faculty members,
then calculate and display their individual pay increases.
At the end of the program, print the total faculty payroll
before and after the pay increase, and the total pay
increase involved.
Answer Posted / sammy
#include <stdio.h>
#include <stdlib.h>
double getIncrease (double curSal);
int main (void)
{
double CurrentSal[3];
double payIncreases[3];
for(int i=0; i<3; i++)
{
printf("Enter the salary for employee %d: $", i+1);
scanf("%d", &CurrentSal);
}
for (int j=0; j<3; j++)
{
payIncreases[j] = getIncrease(CurrentSal[j]);
printf("The pay increase for employee %d is $%d\n",j+1,
payIncreases[j]);
}
system ("pause");
return 0;
}
double getIncrease (double curSal)
{
double PayIncrease;
PayIncrease = curSal*.08;
return PayIncrease;
}
| Is This Answer Correct ? | 1 Yes | 1 No |
Post New Answer View All Answers
What is a program flowchart?
5 Write an Algorithm to find the maximum and minimum items in a set of ānā element.
How does pointer work in c?
What are the different types of linkage exist in c?
write a program for the normal snake games find in most of the mobiles.
Why we not create function inside function.
Between macros and functions,which is better to use and why?
What do you mean by invalid pointer arithmetic?
How can type-insensitive macros be created?
Can we use any name in place of argv and argc as command line arguments?
The number of bytes of storage occupied by short, int and long are a) 2, 2 and 4 b) 2, 4 and 4 c) 4, 4 and 4 d) none
Given only putchar (no sprintf, itoa, etc.) write a routine putlong that prints out an unsigned long in decimal. [ I gave the obvious solution of taking % 10 and / 10, which gives us the decimal value in reverse order. This requires an array since we need to print it out in the correct order. The interviewer wasn't too pleased and asked me to give a solution which didn't need the array ].
What are multidimensional arrays?
Is javascript based on c?
write a program using linked list in which each node consists of following information. Name[30] Branch Rollno Telephone no i) Write the program to add information of students in linked list