DFC2037 - Lab Activity 2
DFC2037 - Lab Activity 2
Duration: 2 Hours
Learning Outcomes
This lab activity encompasses activities 2A, 2B, 2C, 2D and 2E
Declare variables
Use input output statements
Apply operators and expression
SCENARIO:
Congratulations to you!!
You have impressed Miss Suria on your capability to solve the task handed to you in Activity 1.
Therefore, Infinity Design Solution Sdn. Bhd, with the supervision of Miss Suria has given you
the task to help Finance Unit in completing payroll system. The scenario is that; 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.
INSTRUCTION:
Before you continue to write codes in C++, Miss Suria gives you some exercises. Complete the
exercises below and follow the process in completing your codes.
0|Page
DFC 2073 PROGRAMMING FUNDAMENTALS
Activity 2A
Activity Outcome: Declare variables
Duration : 10 minutes
a)
Type Description
bool
Typically a single octet(one byte). This is an integer type.
int
A single-precision floating point value.
double
Represents the absence of type.
wchar_t
b)
Activity 2B
Activity Outcome: Write and compile a program using C++.
Duration : 20 minutes
PROCEDURE OUTPUT
Program 1:
1|Page
DFC 2073 PROGRAMMING FUNDAMENTALS
Activity 2C
Activity Outcome: Apply operators and expression
Duration : 10 minutes
Task 3 : Identify and match the types of operator with their example correctly.
C *= A is equivalent
Logical Operators
to C = C * A
Assignment
(A == B) is not true.
Operators
2|Page
DFC 2073 PROGRAMMING FUNDAMENTALS
Activity 2D
Activity Outcome: Apply operators and expression
Duration : 20 minutes
PROCEDURE OUTPUT
Program 1:
3|Page
DFC 2073 PROGRAMMING FUNDAMENTALS
Program 2:
Activity 2E.1
4|Page
DFC 2073 PROGRAMMING FUNDAMENTALS
Task 1: You must identify the input, process and output from the given task in Case Study.
Activity 2E.2
Activity Outcome: Constructing Flowchart
Duration : 10 minutes
Flowchart
Activity 2E.3
Activity Outcome: Constructing Pseudocode
Duration : 10 minutes
5|Page
DFC 2073 PROGRAMMING FUNDAMENTALS
Pseudocode
Activity 2E.4
Activity Outcome: Write a program code
Duration : 30 minutes
Task 1: Write a complete code of the given task based on 2E.3. Then, compile the program
using C++ and write the output.
Output
Output
6|Page