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

Programming SBA _william

The document outlines a programming project by William Raghunanan from Trinity College East, focusing on a payroll calculator. It details the problem statement, IPO chart, algorithm, trace table, test data, and includes a screenshot of the working code. The program calculates regular and overtime pay for employees based on their job titles and hours worked, outputting the relevant information for each employee.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views

Programming SBA _william

The document outlines a programming project by William Raghunanan from Trinity College East, focusing on a payroll calculator. It details the problem statement, IPO chart, algorithm, trace table, test data, and includes a screenshot of the working code. The program calculates regular and overtime pay for employees based on their job titles and hours worked, outputting the relevant information for each employee.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 13

PROGRAMMING SBA

CANDIDATE NAME : William Raghunanan

SCHOOL: Trinity College East

SCHOOL NUMBER:

1
TABLE OF CONTENTS

PROBLEM STATEMENT.............................................................................3
IPO CHART.................................................................................................3
ALGORITHM...............................................................................................4
TRACE TABLE.............................................................................................6
TEST DATA.................................................................................................7
SCREENSHOT OF WORKING CODE......................................................7
PROGRAM LISTING AND OUTPUT...........................................................8

2
PROBLEM STATEMENT
Firstly, input the employee number, job title and hours worked for each
employee. Then calculate the employee’s regular and overtime pay based
on their pay rates. Finally, output the employee numbers, job titles, hours
worked, regular pay, overtime pay and total pay.

IPO CHART
INPUT PROCESS OUTPUT
EmployeeNumb Prompt for Employee Number EmployeeNum
er ber
JobTitle Read EmployeeNumber JobTitle
HrsWorked Prompt for Job Title HrsWorked
Read JobTitle Regular Pay
Prompt for Hours Worked Overtime Pay
Read HrsWorked Total Pay
Calculate Regular Pay
Calculate Overtime Pay
Calculate Total pay
Print EmployeeNumbers, JobTitles,
HrsWorked, Regular pay, Overtime
pay and Total pay.

ALGORITHM

3
ALGORITHM PayRollCalculator
VARIABLES
EmployeeNumber, Rate of Pay, counter As Integer
JobTitle As String
HrsWorked, Regular Pay, Overtime Pay , Total Pay As Double
BEGIN
HrsWorked = 0
Rate of Pay = 0
Regular Pay = 0
Overtime Pay = 0
Total Pay = 0
FOR counter = 1 TO 12 DO
PRINT “Please enter Employee Number”
READ EmployeeNumber
PRINT “Please enter Job Title”
READ JobTitle
PRINT “Please enter Hours Worked”
READ HrsWorked
IF JobTitle = ‘Manager’ THEN
Rate of Pay = 100
ELSE IF JobTitle = ‘Accountant’ THEN
Rate of Pay = 80
ELSE IF JobTitle = ‘Sales Representative’ THEN
Rate of Pay = 50
ELSE IF JobTitle = ‘Courier Driver’ THEN
Rate of Pay = 30
END IF
IF HrsWorked <= 160 THEN
Regular Pay = HrsWorked * Rate of Pay

4
ELSE
Overtime Pay = (HrsWorked – 160) * Rate of Pay * 2
Regular Pay = Rate of Pay * 160
END IF
Total Pay = Regular Pay + Overtime Pay
PRINT EmployeeNumbers, JobTitles, HrsWorked, Regular pay,
Overtime pay and Total pay.

END FOR
END

5
TRACE TABLE
CODE counter EmployeeNumber JobTitle HrsWorked Rate of RegularPay OvertimePay TotalPay
Line Pay
Number
1 0 - - 0 0 0 0 0
2 0 - - 0 0 0 0 0
3 0 - - 0 0 0 0 0
4 0 - - 0 0 0 0 0
5 0 - - 0 0 0 0 0
6 1 - - 0 0 0 0 0
8 1 1000 - 0 0 0 0 0
10 1 1000 Manager 0 0 0 0 0
12 1 1000 Manager 140 0 0 0 0
14 1 1000 Manager 140 100 0 0 0
22 1 1000 Manager 140 100 14000 0 0
25 1 1000 Manager 140 100 14000 0 14000
CODE counter EmployeeNumbe JobTitle HrsWorked Rate RegularPay OvertimePay TotalPay
Line r of Pay
Number
6 2 1000 Manager 140 100 14000 0 14000
8 2 2000 Manager 140 100 14000 0 14000
10 2 2000 Courier Driver 140 100 14000 0 14000
12 2 2000 Courier Driver 180 100 14000 0 14000
20 2 2000 Courier Driver 180 30 14000 0 14000
23 2 2000 Courier Driver 140 30 14000 1200 14000
24 2 2000 Courier Driver 180 30 4800 1200 14000
25 2 2000 Courier Driver 180 30 4800 1200 6000

6
7
TEST DATA

https://onlinegdb.com/ORn3Een1O

8
SCREENSHOT OF WORKING CODE

PROGRAM LISTING AND OUTPUT

using System;

9
class Program
{
static void Main ()
{
int EmployeeNumber, RateofPay, counter;
string JobTitle;
double HrsWorked, RegularPay, OvertimePay, TotalPay;

// variables are initialized below


HrsWorked = 0;
RateofPay = 0;
RegularPay = 0;
OvertimePay = 0;
TotalPay = 0;

for (counter = 1; counter <= 2; counter++)


{
Console.WriteLine ("Please enter Employee Number");
EmployeeNumber = Convert.ToInt32 (Console.ReadLine());

10
Console.WriteLine ("Please enter Job Title");
JobTitle = (Console.ReadLine());

Console.WriteLine ("Please enter Hours Worked");


HrsWorked = Convert.ToDouble(Console.ReadLine());

//Rates of Pay determined below


if (JobTitle == "Manager")
RateofPay = 100;
else if (JobTitle == "Accountant")
RateofPay = 80;
else if (JobTitle == "Sales Representative")
RateofPay = 50;
else if (JobTitle == "Courier Driver")
RateofPay = 30;

//Pay is calculated below


if (HrsWorked <= 160)

11
RegularPay = HrsWorked * RateofPay;

else
{
OvertimePay = (HrsWorked - 160) * RateofPay * 2;
RegularPay = RateofPay * 160;
}

//Total Pay is calculated below


TotalPay = RegularPay + OvertimePay;

//Information printed below


Console.WriteLine ("Employee number is " + EmployeeNumber);
Console.WriteLine ("Job Title is " + JobTitle);
Console.WriteLine ("Hours Worked are " + HrsWorked);
Console.WriteLine ("Regular Pay is " + RegularPay);
Console.WriteLine ("Overtime Pay is " + OvertimePay);
Console.WriteLine ("Total Pay is " + TotalPay);
}

12
}
}

13

You might also like