PSPD LAB ACTIVITY 3A
PSPD LAB ACTIVITY 3A
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 category and data type for the data value given. Discuss with your lecturer.
Duration : 30 minutes
You are required to determine the data category and data type for each data value below.
Real-number Radius
Real-number Area_circle
Real-number Pi_value
2. Age can be calculated based on the birth year and the current year. State the suitable identifier
and the data type to complete the calculation.
Integer Age_year
Integer Birth_year
Integer Current_year
3. You are creating a simple program to identify if a student’s status (passed or fail) based on
their marks in the mid semester test. State the suitable identifier and data type to complete the program.
Integer marks
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 identifier
and the correct data type to calculate the discounted price for all items bought in the shopping mall.
Real-number Groceries_discount
Real-number Clothing_discount
Integer Item_1
Integer Item_2
Real-number Distance_in_Meter
Real-number Distance_in_kilometer
Activity 3A.3
Variable Constant
identifiers whose value may change values that do not change during
during the course of execution of a program execution
program
Difference
1 break True
2 number False
3 Return True
4 Braces False
5 Void True
6 While True
7 Word False
8 Main False
9 Continue True
10 inT False
11 Integer False
12 Main False
13 Semicolon False
14 Char False
15 If_else False
const
reserved word to keep their options open
logical constants
true
and
words that join together other words or groups of words,
return
return a value immediately from a function.
continue control jumps to the beginning of the loop for next iteration
Activity 3A.4
Activity Outcome: Understand how to write the correct rules of naming identifier.
Duration : 40 minutes
1. Identify whether the following identifiers are valid or invalid? If invalid, give the reason.
2. State VALID or INVALID for the identifiers and data type below. If INVALID (or not suitable), give
the reason.
No underscore
5 951201080225 int Student IC invalid
Use string
No underscore
10 12.5 int enum invalid
Real-number
Define data type for each input, process, output
Correct naming conventions for identifier.
Case Scenario
Activity 3A.5
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.
Payroll
Employee ID
Gross income
Allowance
Overtime
Income_tax
Loan_deduction
Total_income
Total_deduction
Net-salary
Self-Reflection