Chapter 2 - Tutorial 1
IPO - Input ▸ Process ▸ Output
Before any line of code is written, clarify three things: what arrives from the user, what is done with it, and what must appear at the end. The Input-Process-Output pattern keeps those elements in clear view and prevents logic from drifting.
Creating The IPO Table
Phase | Practical Meaning | Typical Keywords (in the problem text) |
---|---|---|
Input | Data accepted from the user — always nouns, never actions. NEVER USE VERB. | enter, read, get |
Process | Operations applied to the inputs — arithmetic, decisions, loops. Each item should begin with a verb. The suggested structure is: VERB + OUTPUT + BASED ON INPUT AND CONSTANT | calculate, compute, determine, if, while, repeat |
Output | The result delivered to the user or another system — again nouns or messages. NEVER USE VERB. | display, print, show |
Applying the Model - Scenarios & Clues
Work through each brief below. For every case, try to create an IPO table and we will discuss the answer together
Scenario 1 - Meal Price with Taxes Question
A government tax of 10% and service tax of 5% will be added to the price of a set of meal bought at MFC. Calculate the total price that Ali has to pay for a set of meal. Write a problem analysis for the given problem statement.
Click for clue
Take a look at the number of items in the menu. Also, don't forget the constant.
Scenario 2 - Cookies Calories Question
A pack contains 40 pieces of cookies. The calorie information claims that there are 10 servings in a pack. Each serving equals 300 calories. Identify the input, process and output to calculate and display the number of total calories consumed.
Click for clue
Be mindful of the kind of calculation that needs to be done.
Scenario 3 - Overtime Pay Question
Create a program that calculates and displays the overtime pay received by an employee. Overtime rate is RM500.00 per hour. Analyse the problem above by determining the input, process and output involved.
Scenario 4 - Langkawi Room with Service Charge Question
Mr Rahman plans to make a reservation for a hotel room in Langkawi Island. The basic rate is RM250.00 per night and service charge is 15% of the room rate. Determine the total payment if he books the hotel room for n nights.
Scenario 5 - Area of Yard Question
The wage to mow the yard of a house is based on the price of diesel used to mow it. The yard to be mowed is shown in the shaded area given in the figure below.
You are given the length and width of the house area and the length and width of the house. The price of diesel used is RM2.00 per square metre. Identify the input, process and output to calculate and display the wage of mowing the yard of the house.
Scenario 6 - Hotels Rate Question
A hotel offers two types of room with different rates.
Room Type | Rate per Night (RM) |
---|---|
Superior | 160 |
Deluxe | 180 |
During the school holidays, the hotel offers a 10% discount on the total room charge. You are going to make a reservation of one Superior room and one Deluxe room for a few nights. Identify the input, process and output to calculate and display the total room charge that you have to pay.
Click for clue
Again, be mindful of the constant.
Scenario 7 - Converting between Bytes Question
Prompt user to input in Kilobyte, and convert the input into Megabyte, Gigabyte, Terabyte and Petabyte.
Click for clue
For bytes, the base for conversion is in base 8
Scenario 8 - Volume of Cuboid Question
A student is required to determine the volume of a cuboid based on the measurements of length, width and height in centimetre units. Determine input, process, and output for the volume calculation problem.
Scenario 9 - Area of Shaded Region Question
You are asked to calculate the area of the shaded area of two circles in the figure below. List down the input, process and output of this problem.
Click for clue
Use the correct formula for calculation
Scenario 10 - International Fax Cost Question
A program created by Amin will calculate the cost of sending an international fax as follows: - Service charges is RM3.00 - RM0.20 per page.
Using problem analysis, determine the input, output and process.