0% found this document useful (0 votes)
3 views3 pages

Gaji Karyawan: Penghitungan dan Pajak

This C++ program calculates the salaries of employees based on their input data, including name, grade, and working hours. It computes gross salary, allowances, taxes, and net salary for each employee. The results are then displayed for each employee after all calculations are completed.

Uploaded by

angger krisna
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views3 pages

Gaji Karyawan: Penghitungan dan Pajak

This C++ program calculates the salaries of employees based on their input data, including name, grade, and working hours. It computes gross salary, allowances, taxes, and net salary for each employee. The results are then displayed for each employee after all calculations are completed.

Uploaded by

angger krisna
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

#include <iostream>

#include <conio.h>

#include <string>

using namespace std;

int main()

string nama[10];

int jum, gol[10],jkerja[10],jlembur[10];

int
gapok[10],glembur[10],tun_pengabdian[10],pajakgapok[10],pajaklembur[10],totpajak[10],gajibersih
[10];

cout<<"Masukan Jumlah Karyawan : ";

cin>>jum;

cout<<endl;

for (int i=1;i<=jum;i++){

cout<<"KARYAWAN KE-"<<i<<endl;

cout<<"Masukan Nama : ";

cin>>nama[i];

cout<<"Masukan Golongan : ";

cin>>gol[i];

cout<<"Masukan Jumlah Jam Kerja : ";

cin>>jkerja[i];

switch (gol[i]){

case 1 :

gapok[i]=1486500;

tun_pengabdian[i]=250000;

break;

case 2 :

gapok[i]=1926000;
tun_pengabdian[i]=300000;

break;

case 3 :

gapok[i]=2456700;

tun_pengabdian[i]=350000;

break;

case 4 :

gapok[i]=2899500;

tun_pengabdian[i]=400000;

break;

default :

gapok[i]=0;

tun_pengabdian[i]=0;

if (jkerja[i]>173){

jlembur[i]=jkerja[i]-173;

}else{

jlembur[i]=0;

glembur[i]=jlembur[i]*20000;

pajakgapok[i]=0.05*gapok[i];

pajaklembur[i]=0.05*glembur[i];

totpajak[i]=pajakgapok[i]+pajaklembur[i];

gajibersih[i]=((gapok[i]+tun_pengabdian[i]+glembur[i])-totpajak[i]);

cout<<endl;

cout<<"PROGRAM MENGHITUNG GAJI KARYAWAN"<<endl;

cout<<endl;
for (int i=1;i<=jum;i++){

cout<<" KARYAWAN KE-"<<i<<endl;

cout<<"Nama : "<<nama[i]<<endl;

cout<<"Gaji Pokok : "<<gapok[i]<<endl;

cout<<"Gaji Lembur : "<<glembur[i]<<endl;

cout<<"Pajak Gaji Pokok : "<<pajakgapok[i]<<endl;

cout<<"Pajak Lembur : "<<pajaklembur[i]<<endl;

cout<<"Total Pajak : "<<totpajak[i]<<endl;

cout<<"Tunjangan Pengabdian : "<<tun_pengabdian[i]<<endl;

cout<<"Gaji Diterima : "<<gajibersih[i]<<endl;

cout<<endl<<endl;

getch();

Common questions

Powered by AI

The use of a fixed tax rate simplifies the payroll calculations by providing a consistent deduction percentage (5%) on both the basic salary and overtime pay. This consistency allows the program to easily apply tax deductions across all levels of employees, reducing complexity and potential discrepancies in tax deductions .

The program uses a switch statement to allocate salaries and allowances based on the 'golongan' entered. If the 'golongan' does not match any of the predefined cases (1-4), default values of 0 are assigned for both the base salary (gapok) and dedication allowance (tun_pengabdian). This effectively handles incorrect inputs by ensuring no salary or allowance is calculated and thereby treated as an error condition .

The program calculates overtime hours by subtracting the threshold of 173 regular working hours from the total hours worked by the employee. If the resulting value is positive, it is considered as the overtime hours (jlembur). The overtime payment is calculated by multiplying the overtime hours (jlembur) by a rate of 20,000 .

Key components missing include validation checks for input data, error handling to manage incorrect entries or overflows, and features such as bonuses, deductions apart from tax like health insurance, and a user-friendly interface for better interaction. Additionally, persistent data storage (e.g., database integration) for audit trails and historical data retrieval is essential for a robust payroll system .

Tax deductions are calculated separately on both the base salary (gapok) and overtime payment (glembur) using a 5% rate. The total tax (totpajak) is the sum of these two deductions. This total tax is then subtracted from the sum of the base salary, dedication allowance, and overtime payment to determine the net salary (gajibersih) received by the employee .

To accommodate varying overtime rates, the program would need to include additional logic within the switch statement to define specific overtime rates for each 'golongan'. A separate array to store these rates and modifying overtime payment calculation to factor in these rates instead of a fixed one would be necessary adjustments. This would increase flexibility but also complexity in terms of computational logic .

The program may face scalability issues due to extensive use of arrays with fixed size and repetitive loops for each employee, which could become inefficient with a large number of employees. Enhancements could include dynamic data structures like vectors to accommodate variable employee numbers and multithreading to handle simultaneous processing of data entries for better performance .

Arrays are used in the program to store related data types for multiple employees, such as names, hours worked, and salaries. This structure allows for efficient access and processing of data, such as looping through the number of employees to perform calculations or retrieve specific information for salary details and tax calculations .

The basic salary and benefits in the program are determined by the employee's 'golongan,' which signifies their level. Depending on the golongan, the program assigns different base salaries (gapok) and dedication allowances (tun_pengabdian). Golongan 1 receives a salary of 1,486,500 and an allowance of 250,000; Golongan 2 receives 1,926,000 and 300,000; Golongan 3 receives 2,456,700 and 350,000; and Golongan 4 receives 2,899,500 and 400,000 .

The program handles input by prompting the user to enter the total number of employees and then sequentially entering details for each employee such as name, level (golongan), and working hours. It uses a for-loop to iterate through each employee entry, collects necessary inputs, performs calculations, and then outputs results such as gross salary, tax and net salary in a structured format. This method is effective in scenarios with a manageable number of employees due to its linear yet repetitive approach .

You might also like