Skip to content

Commit 19a3ff1

Browse files
authored
Merge pull request #49 from JSK-KML/test-main
update tuto 3
2 parents cb8796f + 57e55cf commit 19a3ff1

3 files changed

Lines changed: 64 additions & 7 deletions

File tree

docs/.vitepress/config.mjs

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -87,20 +87,21 @@ export default defineConfig({
8787
],
8888
'/tutorials/' : [
8989

90-
{
91-
text : 'Chapter 2',
92-
collapsed : false,
93-
items : [
90+
91+
9492
{
9593
text: 'Tutorial 1',
9694
link: '/tutorials/chapter-2-tutorial-1'
9795
},
9896
{
9997
text: 'Tutorial 2',
10098
link: '/tutorials/chapter-2-tutorial-2'
99+
},
100+
{
101+
text: 'Tutorial 3',
102+
link: '/tutorials/chapter-3-tutorial-3'
101103
}
102-
]
103-
}
104+
104105

105106
]
106107
},

docs/labs/lab-03.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,6 @@ You are given the length and width of the house area and the length and width of
176176

177177
## Push and Check
178178

179-
After you ahve finish answering all the questions, make sure to [commit and push](./lab-01.md#commit-and-push) your files back to your repo.
179+
After you have finish answering all the questions, make sure to [commit and push](./lab-01.md#commit-and-push) your files back to your repo.
180180

181181
In the Github repo, make sure that the commit passed all the test. Recall back [here](./lab-02.md#using-flowgorithm-with-github-action) if you forgot how to check it.
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
---
2+
title: Chapter 2 - Tutorial 3
3+
outline : deep
4+
---
5+
6+
# Chapter 2 and 3 - Tutorial 3
7+
8+
## Creating The IPO Table <Badge type="warning" text="Recall" />
9+
10+
| Phase | Practical Meaning | Typical Keywords (in the problem text) |
11+
|------------|------------------|-----------------------------------------|
12+
| **Input** | Data accepted from the user — always *nouns*, never actions. **NEVER USE VERB.** | enter, read, get |
13+
| **Process**| Operations applied to the inputs — arithmetic, decisions, loops. Each item should begin with a **verb**.<br><br> The suggested structure for **selection** question is: <br><br> DETERMINE THE + CONSTANT + BASED ON + INPUT<br><br> VERB + OUTPUT + BASED ON INPUT AND CONSTANT | calculate, compute, determine, if, while, repeat |
14+
| **Output** | The result delivered to the user or another system — again *nouns* or messages. **NEVER USE VERB.** | display, print, show |
15+
16+
17+
18+
## Creating The Flowchart <Badge type="warning" text="Recall" />
19+
20+
| Shape | Usage | Tips |
21+
|------------|----------------------|----------------------------------------------------------------------------|
22+
| Capsule | Input and output | Make sure to use **VERB** to clarify whether you are doing input or output |
23+
| Arrow | Program direction | All shape except diamond can only have one arrow coming out of them, the arrow coming in is limitless |
24+
| Rectangle | Process | One process box can be used for one or multiple process at one time |
25+
| Diamond | Selection | Make sure to put **TRUE** and **FALSE** on arrow going out of the diamond |
26+
27+
28+
## Implementing IPO and Flowchart
29+
30+
For each of the questions below, create an IPO table and its respective flowchart
31+
32+
### Scenario 1 - Selling Magazine <Badge type="tip" text="Question" />
33+
34+
MyHealth magazine is sold at RM5 each if at least 5 units of the magazine are purchased, and it is sold at the price of RM7 each otherwise. Calculate the price a customer has to pay after he enters the quantity of the magazines that he purchased.
35+
36+
### Scenario 2 - Library Books <Badge type="tip" text="Question" />
37+
38+
A library system calculates whether a late fee should be charged to a member returning a book based on the return date. If the book is returned on time, no fee is charged. If it's late, a fee based on the number of overdue days is applied.
39+
40+
### Scenario 3 – Electricity Bill <Badge type="tip" text="Question" />
41+
A utility company charges RM 0.30 per kWh for the first 100 kWh, RM 0.50 per kWh for the next 100 kWh (101–200 kWh), and RM 0.75 per kWh for any usage above 200 kWh.
42+
43+
Calculate the total bill when the customer enters their total kWh consumed.
44+
45+
### Scenario 4 – Income Tax Slab <Badge type="tip" text="Question" />
46+
Income tax is applied as:
47+
48+
- First RM 50 000 → 0%
49+
50+
- Next RM 50 000 → 1%
51+
52+
- Above RM 100 000 → 2%
53+
54+
Given an annual income, calculate total tax due.
55+
56+

0 commit comments

Comments
 (0)