You are on page 1of 4

IPO (Input, Process, Output):

• Input:

• Item name

• Original price of the item

• Process:

• Determine the discount based on the item name using a SWITCH CASE statement.

• Calculate the new price after applying the discount.

• Output:

• Display the item name, original price, discount percentage, and the new price.

Algorithm:

1. Enter item name.

2. Enter original price.

3. Calculate the discount amount: Discount Amount = Original Price * Discount Percentage

4. Calculate the new price: New Price = Original Price - Discount Amount.

5. Display the item name, original price, discount percentage, and the new price.

START

Input item_name;

Input original_price;

SWITCH (item_name);

CASE "Health Enhancement":

discount_percentage = 0.06;

CASE "Baby Treatments":

discount_percentage = 0.12;

CASE "First Aid":

discount_percentage = 0.05;

CASE "Medical Devices":


discount_percentage = 0.08;

DEFAULT:

Display “Invalid Item”;

ENDSWITCH

Calculate discount_amount = original_price * discount_percentage;

Calculate new_price = original_price - discount_amount;

Display item_name;

Display original_price;

Display discount_percentage;

Display new_price;

END
IPO (Input, Process, Output):

• Input:

• Number of patients registered each month in 2022.

• Process:

• Use a WHILE statement to input the number of patients for each month and accumulate
the total.

• Calculate the average number of patients.

• Output:

• Display the average number of patients registered in Dr. Ruz's clinic in 2022.

Algorithm:

1. Set total_patients=0, counter=1,

2. Set constant months=12

3. WHILE counter <= 12:

• Input patients_registered for the current month.

• Add patients_registered to total_patients.

• Increment month by 1.

4. Calculate average_patients = total_patients / months.

5. Display average_patients.

START

Set total_patients=0, counter=1;

Set constant months=12;

WHILE counter <= months

Enter patients_registered;

Calculate total_patients = total_patients + patients_registered;

Calculate average_patients = total_patients / months;

Display average_patients;

counter++;

ENDWHILE
END

You might also like