Recent Question/Assignment
Can you help me with this by writing these three questions as c programming?
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 -time-and 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 employee’s number code (-1 to end): 4
Enter hourly worker’s pay rate: 10
Enter the number of hours worked: 35 fortnightly pay is: 350.00
Enter employee’s number code (-1 to end): 4
Enter hourly worker’s pay rate: 15.5
Enter the number of hours worked: 100 fortnightly pay is: 1860
Enter employee’s number code (-1 to end): 4
Enter hourly worker’s pay rate: 10
Enter the number of hours worked: 40 fortnightly pay is: 400.00
Enter employee’s number code (-1 to end): 1
Enter the Team leaderss pay rate: 576.90 fortnightly pay is: 576.90
Enter employee’s number code (-1 to end): 2
Enter Sales employee’s gross weekly sales:
1091.45 fortnightly pay is: 570.94
Enter employee’s number code (-1 to end): 3
Enter the number of pieces completed: 200 Enter the employee’s per piece pay rate: 0.5 fortnightly pay is: 100
Enter employee’s number code (-1 to end): 8 You have entered an invalid code.
Enter employee’s number code (-1 to end): 9 You have entered an invalid code.
Enter employee’s number code (-1 to end): 3
Enter the number of pieces completed: 100 Enter the employee’s per piece pay rate: 2.75 fortnightly pay is: 275.00
Enter employee’s 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?
The user then inputs the answer (Enter -1 to stop). Next, the program checks the users answer. If its correct, the program should randomly display any of the following messages
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 finally gets 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
Consider a sequence of floating point numbers, x,,i = 1,2, m. The mean is defined as: x = (xj +x2+»—,+xm)/m
the deviation about the mean is
d, = x, - x / = 1,2, ..., m
and the standard deviation is
s = yj(df + +.•••,+)/(m-1)
Write a complete C program to do the following tasks:
(!) Read a positive integer from user as the value of m (need to verify that m is positive but less than 30).
(ii) Read in the m elements (up to 30) of a one-dimensional floating point array, compute the sum of these elements, the mean, the deviation, and the standard deviation.
5 a
Key in a positive integer:32 Urong input, plz try again Key in a positive integer:-l Wrong input, plz try again Key in a positive integer:5 xE0J=1 xEU=2 xE2]=3 xE3]=4 xMJ-5 mean = 3.00
Deviation Ex=1.00J = -2.00 Deviation Ex=2.00] = -1.00 Deviation Ex-3.001 = 0.00 Deviation Ex=4.00] ¦ 1.00 Deviation Ex=5.00] « 2.00
Standard Deviation = 1.58