Professional Documents
Culture Documents
ACTIVITY 3A: Fundamentals of Programming Language: Learning Outcomes
ACTIVITY 3A: Fundamentals of Programming Language: Learning Outcomes
Duration: 2 Hours
Learning Outcomes
This lab activity encompasses activities 3A.1, 3A.2, 3A.3, 3A.4 and 3A.5
CASE STUDY
Infinity Design Solution Sdn. Bhd, an advertising company wants to automate the system of managing Human
Resources (HR) data. Cik Suria was selected to be an IT programmer for Infinity Design Solution. En. Mohamed
insist to develop a system to manage staff payroll. Cik Suria has to prepare a proposal for payroll system.
INSTRUCTION:
1. Define the appropriate data type for each input, process and output.
2. Define proper correct naming convention for identifier.
Activity 3A.1
Activity Outcome: Identify the data type for the expression below.
Duration : 20 minutes
Based on expression below, you are required to determine the data type for each expression below:
1 Number123
2 2016
3 -0.000000001
4 0.741
5 X
6 $
7 173.00
8 ()
9 grade
10 123456
Activity 3A.2
Activity Outcome: Identify the variables and data type based on the problems.
Duration : 25 minutes
Based on the problem given, writes the suitable variable and data type.
2. Age can be calculated based on the birth year and the current year. State the suitable variable and the data
type to complete the calculation.
Variable Data type
3. You are creating a simple program to identify if a student passed or fail for their marks in the mid semester
test. State the suitable variable and data type to complete the program.
Variable Data type
4. A shopping mall is currently having a sale for the coming festive season. All groceries item will be given
20% discount and all clothing 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.
Variable Data type
5. A simple program is created to store personal data of an employee. The information that needs to be store
includes full name, phone number and employee number. State the suitable variable and data type to
complete the program.
Variable Data type
Activity 3A.3
Activity Outcome: Understand identifier, variable, constant and reserved words.
Duration : 20 minutes
1. Give the meaning of variable and constant and briefly explain the different between variable and
constant?
Variable Constant
1 break
2 number
3 return
4 braces
5 void
6 while
7 word
8 if
9 continue
10 int
3. Explain the function of the following terms and include 1 example of usage in C++ programming.
Terms Function Example
const
true
and
return
Activity 3A.4
Activity Outcome: Understand how to write the correct rules of naming identifier.
Duration : 25 minutes
1. Which of the following variables, identify valid or invalid? If invalid, give the reason.
1 Age
2 !ex
3 R79J
4 TotalIncome
5 _invalid
6 #validhashtag
7 100student
8 my_polytechnic
9 ILike Reading
10 num,ber1
int class;
1
float price$;
2
int &studentName;
3
char %discountRate;
4
int _ICnumber;
6
char 4saleItem;
7
int register;
8
char switch;
9
int enum;
10
Activity 3A.5
Activity Outcome: System design (variable and data type )
Duration : 30 minutes
Define the correct variable and data type for module manage staff payroll.
PROBLEM
Case Senario:
The system will automate the process of calculate payroll for employees worked at Infinity Design Solution Sdn. Bhd.
Each employee will be recognized by employee ID. The system will receive gross income, allowance, overtime, income
tax and loan deduction. The system will automatically calculate the total income, total deduction and net salary for the
employee.