0% found this document useful (0 votes)
130 views

Lab Assignment 1 Answer Sheet

This lab assignment asks students to calculate an employee's net salary based on their basic salary, allowances, gross salary, deductions, and total net salary. The coding question provides the input values for a sample employee and asks students to output the employee information including their name, ID, salaries, deductions, and net salary. The document includes the coding question, sample C++ code to calculate the net salary, and expected output. It also lists rubrics to grade the coding question out of 20 points.

Uploaded by

Amir Aiman
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
130 views

Lab Assignment 1 Answer Sheet

This lab assignment asks students to calculate an employee's net salary based on their basic salary, allowances, gross salary, deductions, and total net salary. The coding question provides the input values for a sample employee and asks students to output the employee information including their name, ID, salaries, deductions, and net salary. The document includes the coding question, sample C++ code to calculate the net salary, and expected output. It also lists rubrics to grade the coding question out of 20 points.

Uploaded by

Amir Aiman
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 5

INTRODUCTION COMPUTER

PROGRAMMING
(CSC415)

LAB ASSIGNMENT 1
(Topic 2-5%)

Prepared By : Name: AMIR AIMAN BIN JANORIN


Student ID: 2022608348
Group: CS2421A
Program Code: CS242
Program Name: ACTUARIAL SCIENCE
Faculty Name: FACULTY OF COMPUTER SCIENCE
AND MATHEMATICS

Prepared For: MISS HAFIZATUL HANIN HAMZAH

Assigned date: 8 NOVEMBER 2022


Submission date: 17 NOVEMBER 2022
Page 2 of 5

Questions

1) Calculate the net salary for a worker. The net salary is the different of gross salary and
total deduction. The gross salary is the total of basic salary and total allowances. The
allowances are housing allowance, telephone allowance and transportation. Each of
allowance is RM500, RM700, and RM750. The worker has to contribute to EPF
deduction 9% of gross salary and contribution for SOCSO 2% of gross salary. Display the
worker name, employee id, basic salary, total allowances, gross salary, total deduction,
and the net salary that he/she get. Then display the employee salary information as an
example below:
Page 3 of 5

CODING
#include<iostream>
using namespace std;
int main()
{
//input
int total_allowances, gross_salary;
double total_deduction, net_salary;
int housing_allowance = 500;
int telephone_allowance = 700;
int transportation = 750;
int basic_salary = 10000;

//process
total_allowances = housing_allowance + telephone_allowance + transportation;
gross_salary = basic_salary + total_allowances;
total_deduction = (0.09*gross_salary) + (0.02*gross_salary);
net_salary = gross_salary - total_deduction;

//output
cout<<" Employee Salary Information"<<endl;
cout<<" "<<endl;
cout<<"Name : Khairunnisa Bt Abdul Kadir"<<endl;
cout<<"Employee ID : 20154231"<<endl;
cout<<" "<<endl;
cout<<"Basic Salary : "<<"RM "<<basic_salary<<".00"<<endl;
cout<<"Total Allowances : "<<"RM "<<total_allowances<<".00"<<endl;
cout<<"Gross Salary : "<<"RM "<<gross_salary<<".00"<<endl;
cout<<"Total Deduction : "<<"RM "<<total_deduction<<"0"<<endl;
cout<<"Net Salary : "<<"RM "<<net_salary<<"0"<<endl;
return 0;
}
Page 4 of 5

OUTPUT SCREEN
Page 5 of 5

RUBRICS

QUESTION NO 1 (SOURCE CODES)

Input Statement 3

Output Statement 5

Process 8

Structure of Codes 2

(pre-processor,
comments,
declaration
variables, good
styles)

Output Screen 2

Total 20

You might also like