Vous êtes sur la page 1sur 2

Assignment 01 Algorithms & Flowcharts

Q1. The algorithm (pseudocode) is given for the following problem. Draw the flowchart. a) read an employee name (NAME), overtime hours worked (OVERTIME), hours absent (ABSENT) and b) determine the bonus payment (PAYMENT) c) Table for bonus:

Bonus Schedule OVERTIME (2/3)*ABSENT BONUS PAID >40 hours >30 but 40 hours >20 but 30 hours >10 but 20 hours
10 hours

$50 $40 $30 $10

Step 1: Input NAME,OVERTIME,ABSENT Step 2: if (OVERTIME(2/3)*ABSENT > 40) then PAYMENT 50 else if (OVERTIME(2/3)*ABSENT > 30) then PAYMENT 40 else if (OVERTIME(2/3)*ABSENT > 20) then PAYMENT 30 else if (OVERTIME(2/3)*ABSENT > 10) then PAYMENT 20 else PAYMENT 10 endif Step 3: Print Bonus for, NAME is $, PAYMENT

Q2: The unit for electricity usage is kWh. For domestic usage, the monthly rate is 21.8 cents/unit for the first 200 unit, 25.8 cents/unit for the next 800 units and 27.8 cents/unit for each additional

units. Given the amount of electricity units (in kWh) used by a customer, calculate the amount of money needs to be paid by the customer to Electric Company. A bill statement needs to be printed out. Write a pseudocode and a flow chart to solve the above problem

Q3: Write the pseudocode for the following flowchart