0% found this document useful (0 votes)
42 views6 pages

UAS - Praktikum Algoritma Dan Pemrograman 2

The document discusses a C++ program to calculate employee salaries. It takes employee data as input such as name, ID number, job level, and years of service. It then calculates the basic salary, allowance, and total salary based on job level and years of service. The program output displays the employee data and calculations.

Uploaded by

Trifena Boko
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)
42 views6 pages

UAS - Praktikum Algoritma Dan Pemrograman 2

The document discusses a C++ program to calculate employee salaries. It takes employee data as input such as name, ID number, job level, and years of service. It then calculates the basic salary, allowance, and total salary based on job level and years of service. The program output displays the employee data and calculations.

Uploaded by

Trifena Boko
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/ 6

Nama : Alesandro Mone

NIm : 20120018

Kelas :G

UAS : Praktikum algoritma Dan Pemrograman 2

1.

• Mulai

• Masukkan nip,nama, gol,TMK

• Menghitung gaji, gaji = gapol + bonus

• Gol 1 : gapol = 1.800.00

• Gol 2 : gapol = 2.000.00

• Gol 3 : gapol = 2.200.00

• Gol 4 : gapol = 2.200.00

• Menghitung lk, lk = 2020 – tmk

• Lk >= 5 : tunjangan = 250.000

• Selain itu tunjangan = 0

• Hasil akhir : nama, nip, gol, TMK, gaji gapol, tunjangan, lk

• Selesai

2. PROGRAMNYA:

#include <iostream>

using namespace std;

int main(){

char nama[30];

int nip ,gol;

int bonus;

int tmk;

int gapol;

int tunjangan;
cout <<"masukan nama anda \t:";

gets(nama);

cout << endl;

cout <<"masukan nip \t:";

cin >> nip;

cout << endl;

cout <<"masukan tahun masuk kerja \t:";

cin >> tmk;

cout << endl;

cout <<"Masukan Golongan (1-4) \t:";

cin >> gol;

cout<<"===========================================================" << endl;

if(gol == 1){

int gapol = 180000;

int lk = 2020 - tmk;

int gaji= gapol+bonus;

cout <<"Gapol \t:" << gapol << endl;

cout <<"lama kerja anda \t:" << lk << " tahun" << endl;

cout <<"Gaji Anda \t:" << gaji << endl;

else if(gol == 2){

int gapol = 200000;

int lk = 2020 - tmk;

int gaji= gapol+bonus;

cout <<"Gapol \t:" << gapol << endl;

cout <<"lama kerja anda \t:" << lk << " tahun" << endl;

cout <<"Gaji Anda \t:" << gaji << endl;

else if(gol ==3){


int gapol = 220000;

int lk = 2020 - tmk;

int gaji= gapol+bonus;

cout <<"Gapol \t:" << gapol<< endl;

cout <<"lama kerja anda \t:" << lk << " tahun" << endl;

cout <<"Gaji Anda \t:" << gaji << endl;

int lk = 2020 - tmk;

if(lk >=5){

tunjangan = 250000;

cout <<"Tunjangan \t:" << tunjangan << endl;

else{

tunjangan = 0 ;

}
HASIL OUTPUTNYA:

3. PROGRAMNYA:

#include <iostream>

#include <stdio.h>

#include <iomanip>

using namespace std;

int main(){

int n;

char a[1000][30],b[1000][30],c[1000][30],d[1000][30],e[1000][30],f[1000][30],g[1000][30],h[1000][30];

cout<<"Input:\n\n";

cout<<"Masukan banyak data yang ingin diinput = ";

cin>>n;

cout<<endl<<endl;

for (int i=0;i<n;i++){

cout<<"Data ke-"<<i+1<<endl;

cout<<"Masukan Nama\t= ";

scanf(" %[^\n]s",a[i]);
cout<<"Masukan Nip\t= ";

scanf(" %[^\n]s",b[i]);

cout<<"Masukan Gol\t= ";

scanf(" %[^\n]s",c[i]);

cout<<"Masukan TMK\t= ";

scanf(" %[^\n]s",d[i]);

cout<<"Masukan Gaji\t= ";

scanf(" %[^\n]s",e[i]);

cout<<"Masukan Gapol\t= ";

scanf(" %[^\n]s",f[i]);

cout<<"Masukan Tunjangan\t= ";

scanf(" %[^\n]s",g[i]);

cout<<"Masukan LK\t= ";

scanf(" %[^\n]s",h[i]);

system("CLS");

cout<<"Output:\n\n";

cout<<"===============================================================================
========\n";

cout<<"| No | Nama | Nip | Gol | TMK | Gaji | Gapol | Tunjangan | LK |\n";

cout<<"===============================================================================
========\n";

for(int i=0;i<n;i++){

cout<<"| "<<setiosflags(ios::left)<<setw(5)<<i+1<<"|";

cout<<" "<<setiosflags(ios::left)<<setw(5)<<a[i]<<"|";

cout<<" "<<setiosflags(ios::left)<<setw(5)<<b[i]<<"|";

cout<<" "<<setiosflags(ios::left)<<setw(5)<<c[i]<<"|";

cout<<" "<<setiosflags(ios::left)<<setw(5)<<d[i]<<"|";

cout<<" "<<setiosflags(ios::left)<<setw(5)<<e[i]<<"|";
cout<<" "<<setiosflags(ios::left)<<setw(5)<<f[i]<<"|";

cout<<" "<<setiosflags(ios::left)<<setw(5)<<g[i]<<"|";

cout<<" "<<setiosflags(ios::left)<<setw(5)<<h[i]<<"|";

cout<<"\
n====================================================================================
\n";

HASIL OUTPUTNYA:

You might also like