Question: The program below has been generalized to read a user's input value for hourlyWage. Run the program. Notice the user's input value of 10 is
The program below has been generalized to read a user's input value for hourlyWage.
Run the program. Notice the user's input value of 10 is used. Modify that input value, and run again.
Generalize the program to get user input values for workHoursPerWeek and workWeeksPerYear (change those variables' initializations to 0). Run the program.
monthsPerYear will never change, so declare that variable as const. Use the standard for naming constant variables. Ex: const int MAX_LENGTH = 99. Run the program.
Change the values in the input area below the program, and run the program again.
#include
int main (void) { int hourlyWage = 0; int workHoursPerWeek = 40; int workWeeksPerYear = 50; int monthsPerYear = 12; // FIXME: Declare as const and use standard naming int annualSalary = 0; int monthlySalary = 0;
printf("Enter hourly wage: "); scanf("%d", &hourlyWage);
// FIXME: Get user input values for workHoursPerWeek and workWeeksPerYear
annualSalary = hourlyWage * workHoursPerWeek * workWeeksPerYear; printf("Annual Salary is: "); printf("%d ", annualSalary);
// FIXME: Change monthsPerYear to the const variable that uses the standard naming printf("Monthly salary is: "); printf("%d ", monthlySalary);
return 0; }
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
