Lab Activity 2: Basic C++ Program: Duration: 2 Hours
Lab Activity 2: Basic C++ Program: Duration: 2 Hours
Lab Activity 2: Basic C++ Program: Duration: 2 Hours
Duration: 2 Hours
Learning Outcomes
• 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.
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)
Duration : 10 minutes
Task 3 : Identify and match the types of operator with their example correctly.
Types of Examples
operator
Arithmetic Operators (A & B) will give 12
which is 0000 1100
Relational Operators
A++ will give 11
C *= A is equivalent
Logical Operators
to C = C * A
Bitwise Operators (A && B) is false.
Assignment
(A == B) is not true.
Operators
Activity 2E.1
Activity Outcome: Identify input, process and output
Duration : 10 minutes
Task 1: You must identify the input, process and output from the given task in Case Study.
Duration : 10 minutes
Flowchart
Activity 2E.3
Activity Outcome: Constructing Pseudocode
Duration : 10 minutes
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