Question 01
A mobile manufacturing company pays its employees as follows: 1) Team leaders (fixed fortnightly salary)
2) Sales workers ($500 plus 6.5% of their gross fortnightly sales)
3) Pieceworkers (fixed amount of money per item for each of the items they produce, each piece worker in this company works on only 1 type of item)
4) Hourly workers (fixed hourly wage for up to the first 60 hours they work and -timeand a-half- i.e. 1.5 times their hourly wage, for overtime hours worked)
Write a program to compute the weekly pay for each employee. You do not know the number of employees in advance.
Each type of employee has its own pay code:
Code 1: Team leaders
Code 2: Sales workers
Code 3: Pieceworkers
Code 4: Hourly workers
There will be an undetermined number of entries into the payroll. Use a switch to compute each employees pay based on that employees pay code. Within the switch, prompt the user (i.e. the payroll clerk) to enter the appropriate facts your program needs to calculate each employees pay based on that employees pay code. Print each pay value and when done with the entries, print total amount of payroll.
Sample Run:
Enter employees number code (-1 to end): 4
Enter hourly workers pay rate: 10 Enter the number of hours worked: 35 fortnightly pay is: 350.00
Enter employees number code (-1 to end): 4
Enter hourly workers pay rate: 15.5 Enter the number of hours worked: 100 fortnightly pay is: 1860
Enter employees number code (-1 to end): 4
Enter hourly workers pay rate: 10 Enter the number of hours worked: 40 fortnightly pay is: 400.00
Enter employees number code (-1 to end): 1
fortnightly pay is: 576.90
Enter employees number code (-1 to end): 2 Enter Sales employees gross weekly sales: 1091.45 fortnightly pay is: 570.94
Enter employees number code (-1 to end): 3
Enter the number of pieces completed: 200 Enter the employees per piece pay rate: 0.5 fortnightly pay is: 100
Enter employees number code (-1 to end): 8 You have entered an invalid code.
Enter employees number code (-1 to end): 9 You have entered an invalid code.
Enter employees number code (-1 to end): 3
Enter the number of pieces completed: 100 Enter the employees per piece pay rate:
2.75 fortnightly pay is: 275.00
Enter employees number code (-1 to end): -1
The total payroll for the fortnight is:4132.84
Question 02
Use the rand function to produce two positive one-digit integers (0 includes). The program should then prompt the user with a question, such as How much is 2 + 3?
er. If
1. Very good!
2. Excellent!
3. Nice work!
4. Keep up the good work!
and ask another addition question.
If the answer is wrong, randomly display any of the following messages.
1. No. Please try again.
2. Wrong. Try once more.
3. Dont give up!
4. No. Keep trying and let the user try the same question repeatedly until the user finallygets it right.
A separate function should be used to generate each new question. This function should be called once when the application begins execution and each time the user answers the question correctly.
(Hint: Use random-number generation to choose a number from 1 to 4 that will be used to select one of the four appropriate responses to each correct or incorrect answer. Use a switch statement to issue the responses.)
Question 03
Question 04
Write a complete C program to calculate area and circumference of a circle. Your program should have the following functions in addition to a main() function.
1. Menu that displays
Do you want to use radius or diameter for the calculation?
Enter 1 for radius
Enter 2 for diameter
Enter -1 to exit
2. diameter_to_radius receives diameter (double) as a parameter and returns radius (double).
3. random_value_generator generates random values (double) between minimum and maximum.
4. area receives radius (double) as a parameter and returns area (double).
5. circumference - receives radius (double) as a parameter and returns circumference (double).
You should start the program by prompting the user to select radius or diameter for the calculation (validate the choice).
radius:
You should ask the user to choose a unit, either cm or m (validate the choice), for the calculation. Generate a random double value (use random_value_generator) between 5. 0 (minimum) and 15.0 (maximum) for the radius. Prompt the user to choose either area or circumference calculation (prompt by using character A for area and C for circumference validate choice).
diameter:
You should ask the user to choose a unit, either cm or m (validate the choice), for the calculation. Generate a random double value (use random_value_generator) between 15.0 and 30.0 for the diameter. Before calculating area or circumference convert diameter to radius (use diameter_to_radius function).
You should exit the program only when the user inputs -1.
All results are printed in main, show only two decimal numbers in the final result.
The formatting of the output should be similar (including the units) to the screen shot shown.
In this task double means double precision floating point value.
GET ANSWERS / LIVE CHAT