Computer Science, asked by dd1598061, 2 months ago

1 FUNCTION PayEmp (Integer workHrs, Integer sales) RETURNS Integer
2. Integer Pay, PayPerhr, SalesPay
3 SET PayPerHr = 5
IF sales<10000 THEN
SET SalesPay = 150
ELSE IF sales<50000 THEN
7
SET SalesPay
= 750
8 ELSE
9
SET SalesPay = ((150*100)/10000) +0.5)*sales/109
END IF
SET Pay
PayperHr * workHrs + SalesPay
RETURN Pay
13 END FUNCTION
Гол доо
15 PROGRAM START
Integer Pay
SET Pay
= CALL PayEmp (20,60000)
18 Print 'You have to pay: Rs.', Pay
19 STOP​

Answers

Answered by kadamanushree507
0

Answer:

Sorry I can't understand that what's ur question is

Answered by vinod04jangid
0

Answer:

OUTPUT:- You have to pay: Rs.1474.

Explanation:

Step 1:- Function PayEmp (Integer workHrs, Integer sales)  - In this step a function PayEmp takes two positional arguments i.e. workHrs and sales that is of integer data type.

Step 2:- Integer Pay, PayPerhr, SalesPay - Here we have declared 3 local variables.

Step 3:- SET PayPerHr = 5 - Here we have initialized the value of PayPerHr.

Step 4:- IF sales < 10000 THEN - Here we check if the sales value is less than 10,000.

Step 5:- SET SalesPay = 150 - If Step 4 Evaluates to true then SalesPay = 150

Step 6:- ELSE IF sales < 50000 THEN - If Step 4 returns false then we check if sales is less than 50,000.

Step 7:- SET SalesPay = 750 - If Step 6 evaluates true then SalesPay becomes 750.

Step 8:- ELSE - If both Step 4 and Step 6 condition is not satisfied then Else block is executed.

Step 9:- SET SalesPay = ((150*100)/10000) +0.5)*sales/109

Step 10:- END IF - If block ends here.

Step 11:- SET Pay = PayperHr * workHrs + SalesPay - Here the value of Pay variable is assigned.

Step 12:- RETURN Pay - Value of Pay is returned from the function.

Step 13:- END FUNCTION - Function ends here.

Step 14:- Main Function starts here.

Step 15:- Integer Pay - int type variable Pay is declared.

Step 16:- SET Pay = CALL PayEmp (20,60000) - Value returned from the function PayEmp(20, 60000) is stored in variable Pay.

Step 17:- Print 'You have to pay: Rs.', Pay - Value of Pay is printed in the output.

Step 18:- STOP - Program stops here.

Since the value of sales = 60000, so it enters the else block and the value of SalesPay becomes = ((150*100)/10000) +0.5)*60000/109

                                              = (1.5 + 0.5) * 60000 / 109

                                              = 1374

Then Pay = 5 * 20 + 1374

                = 1474.

OUTPUT:- You have to pay: Rs.1474.

#SPJ3

To see similar questions, click the below links:

https://brainly.in/question/10679270?msp_srt_exp=4

https://brainly.in/question/18919646?msp_srt_exp=4

Similar questions