Professional Documents
Culture Documents
Table of Contents
TOPICS PAGES
Introduction to Fundamentals of
ACTIVITY 1: 2
Programming
ACTIVITY 2: Basic C++ Program 10
2|Page
DFC20113 PROGRAMMING FUNDAMENTALS
Duration: 2 Hours
Learning Outcomes
This lab activity encompasses activities 2A, 2B, 2C, 2D, 2E and 2F
Declare variables
Use input output statements
Apply operators and expression
Activity 2A
Activity Outcome: Declare variables
Duration : 5 minutes
Identify the suitable data type for each variable and declare it.
city
weight
grade
noOfStudent
3|Page
DFC20113 PROGRAMMING FUNDAMENTALS
Activity 2B
Activity Outcome: Identify the variables and data type based on the problems.
Duration : 15 minutes
2. A simple program is created to store personal data of a student. The information that
needs to be store includes full name, phone number, matric number and address. State the
suitable variable and data type to complete the program.
3. A shopping mall is currently having a sale for Christmas festive season. All toys item will
be given 10% discount and all groceries item will be given 15% discount. State the suitable
variable and the correct data type to calculate the discounted price for all items bought in
the shopping mall.
4|Page
DFC20113 PROGRAMMING FUNDAMENTALS
Activity 2C
Activity Outcome: Understand how to write the correct rules of naming identifier.
Duration : 10 minutes
10 myemail@pbu
5|Page
DFC20113 PROGRAMMING FUNDAMENTALS
Activity 2D
Activity Outcome: Apply input output statements
Duration : 20 minutes
1. Based on the output below, execute the programming code that asks the user to enter their matric
number.
2. Based on the output below, execute the programming code that asks the user to enter two
numbers. The variables are Num1 and Num2.
6|Page
DFC20113 PROGRAMMING FUNDAMENTALS
Activity 2E
Activity Outcome: Apply operators and expression
Duration : 30 minutes
a)
Step 1: Declare three variables which are a, b and c with data type integer.
7|Page
DFC20113 PROGRAMMING FUNDAMENTALS
b)
c)
Step 1: Declare variable P, Q and R.
8|Page
DFC20113 PROGRAMMING FUNDAMENTALS
Activity 2F.1
SCENARIO:
In January of each year, Infinity Design Solution Sdn. Bhd pays a 5% bonus to each of its salespeople.
The bonus is based on the amount of sales made by the sales person during the previous year.
Task 1: You must identify the input, process and output from the given task in Case Study.
Activity 2F.2
Activity Outcome: Constructing Flowchart
Duration : 10 minutes
Flowchart
9|Page
DFC20113 PROGRAMMING FUNDAMENTALS
Activity 2F.3
Activity Outcome: Constructing Pseudocode
Duration : 10 minutes
Pseudocode
Activity 2F.4
Activity Outcome: Write a program code
Duration : 30 minutes
Output
10 | P a g e