Question
In C... Consider the following: void initialize(int* one, int* two, char* ch); void getHoursRate(double* hrs, double* pRate); double payCheck(double hrs, double pRate); void printCheck(double hrs,
In C...
Consider the following:
void initialize(int* one, int* two, char* ch); void getHoursRate(double* hrs, double* pRate); double payCheck(double hrs, double pRate); void printCheck(double hrs, double pRate, double pSalary); void funcOne(int* pOne, int pTwo); void nextChar(char* ch);
int main() { int x, y; char z; double rate, hours; double amount; ....
}
The variables x, y, z, rate, and hours referred to in items below are the variables of the function main above.
Implement the following definitions: void initialize(int* one, int* two, char* ch): that initializes x and y to 0 and z to the '~' character
void getHoursRate(double* hrs, double* pRate): that prompts the user to input the hours worked and rate per hour to initialize the variables hours and rate of the function main
double payCheck(double hrs, double pRate): calculates and returns the amount to be paid to an employee based on the hours worked and rate per hour. The hours worked and rate per hour are stored in the variables hours and rate, respectively, of the function main. The formula for calculating the amount to be paid is as follows: For the first 40 hours, the rate is the given rate; for hours over 40, the rate is 1.5 times the given rate
void printCheck(double hrs, double pRate, double pSalary): prints the hours worked, rate per hour, and the salary
void funcOne(int* pOne, int pTwo): prompts the user to input a number. The function then changes the value of x by assigning the value of the expression two times the (old) value of x plus the value of y minus the value entered by the user.
void nextChar(char* ch): prompts the user to enter a character and sets the value of z to the next character stored in z.
For Example:
After initialization: x = 0, y = 0, z = ~ Enter hours worked: 10 Enter pay rate: 20 Hours worked: 10.000000 Pay Rate: $20.000000 This week's salary: $200.000000 Before calling funcOne: x = 35, y = 20 Enter an integer: 33 After funcOne: x = 57 Before nextChar z = ~ Enter a character: B After nextChar: z = C
starter code...
#includevoid initialize(int* one, int* two, char* ch); void getHoursRate(double* hrs, double* pRate); double payCheck(double hrs, double pRate); void printCheck(double hrs, double pRate, double pSalary); void funcOne(int* pOne, int pTwo); void nextChar(char* ch); int main() { int x, y; char z; double rate, hours; double amount; // call initialize here... printf("After initialization: x = %d, y = %d, z = %c ", x, y, z); //call getHoursRate here... //call payCheck here... //call printCheck here... x = 35; y = 20; printf("Before calling funcOne: x = %d, y = %d ", x, y); //call funcOne with x & y here... printf("After funcOne: x = %d ", x); z = 'B'; printf("Before nextChar z = %c ", z); //nextChar with z here... printf("After nextChar: z = %c ", z); return 0; }
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started