0% found this document useful (0 votes)
39 views7 pages

Nama: I Kadek Yogi Kurniawan NIM: 19102125 Kelas/Jurusan: E Malam/sistem Komputer

This document contains code for a hotel booking and payroll calculation program in C language. It includes function definitions to calculate room booking costs and employee salaries. The main program allows the user to select either booking or payroll calculation, enters the necessary input data, then calls the appropriate function to display the results. Key functions calculate room rates based on room type and number of nights, and payroll amounts based on salary grade, marital status, dependents.

Uploaded by

Yogi Kurniawan
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)
39 views7 pages

Nama: I Kadek Yogi Kurniawan NIM: 19102125 Kelas/Jurusan: E Malam/sistem Komputer

This document contains code for a hotel booking and payroll calculation program in C language. It includes function definitions to calculate room booking costs and employee salaries. The main program allows the user to select either booking or payroll calculation, enters the necessary input data, then calls the appropriate function to display the results. Key functions calculate room rates based on room type and number of nights, and payroll amounts based on salary grade, marital status, dependents.

Uploaded by

Yogi Kurniawan
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/ 7

Nama : I Kadek Yogi Kurniawan

NIM : 19102125
Kelas/Jurusan : E malam/Sistem Komputer

Function:

File header.h

#include<stdio.h>

#include<stdlib.h>

int booking_kamar_hotel(int room, int lama, char nama[100]);

File function.c

#include"header.h"

int booking_kamar_hotel(int room, int lama, char nama[100])


{
int jbiaya, r1,r2,r3,r4;
r1=650000;
r2=900000;
r3=1200000;
r4=1500000;
if(room=1){
jbiaya=r1*lama;
}
else if(room=2){
jbiaya=r2*lama;
}
else if(room=3){
jbiaya=r3*lama;
}
else if(room=4){
jbiaya=r4*lama;
}
return jbiaya;
}
File main.c
#include"header.h"

int main(){

int room, lama;

char nama[100];

printf("========== Booking Kamar Hotel ===========\n");

printf("Jenis & Harga hotel per-malamnya:\n");

printf("1. single Room : Rp 650.000,-/malam\n");

printf("2. Double Room : Rp 900.000,-/malam\n");

printf("3. single Room : Rp 1.200.000,-/malam\n");

printf("4. single Room : Rp 1.500.000,-/malam\n");

printf("==========================================\n");

printf("silahkan pilih jenis kamar hotel :"); scanf("%i",&room);

printf("Berapa Lama anda menginap? :");scanf("%i",&lama);

printf("Ketikan Nama anda :");scanf("%s",&nama);

printf("==========================================\n");

printf("hai %s\n",nama);

printf("total biaya yang harus anda bayar :%i",booking_kamar_hotel(room,lama,nama));

return 0;

Procedure:
File header.h

#include<stdio.h>

#include<stdlib.h>

#include<conio.h>

void menghitung_gaji(int gajipokok, int status, int anak, int total, char nama[100]);

void booking_kamar_hotel(int room,int lama, char nama[100]);


File function.c

#include "header.h"

void menghitung_gaji(int gajipokok, int status, int anak, int total, char nama[100])

int gaji,tanak,tunjangankawin;

if(status==1 && gajipokok==1){

gaji=2000000;

tunjangankawin=0;

tanak=0;

total=2000000+tunjangankawin+tanak;

status="Single";

else if(status=2 && gajipokok==1){

gaji=2000000;

tunjangankawin=0.5*2000000;

tanak =anak*25*2000000/100;

total=2000000+tunjangankawin+tanak;

status="Married";

else if(status==1 && gajipokok==2){

gaji=3000000;

tunjangankawin=0;

tanak=0;

total=3000000+tunjangankawin+tanak;

status="Single";

}
else if(status==1 && gajipokok==3){

gaji=4000000;

tunjangankawin=0;

tanak=0;

total=4000000+tunjangankawin+tanak;

status="Single";

else if(status=2 && gajipokok==2){

gaji=3000000;

tunjangankawin=0.5*3000000;

tanak =anak*25*3000000/100;

total=3000000+tunjangankawin+tanak;

status="Married";

else if(status=2 && gajipokok==3){

gaji=4000000;

tunjangankawin=0.5*4000000;

tanak =anak*25*4000000/100;

total=4000000+tunjangankawin+tanak;

status="Married";

printf("===========================================\n");

printf("hai %s\n",nama);

printf("status anda : %s\n",status);

printf("Gaji Pokok anda =%i",gaji);

printf("\ntunjangan Rumahtangga =%i",tunjangankawin);

printf("\nTunjangan Anak =%i",tanak);

printf("\nTotal gaji anda =%i",total);

}
void booking_kamar_hotel(int room,int lama, char nama[100])

int jbiaya;

if(room==1){

jbiaya = 650000*lama;

else if(room==2){

jbiaya = 900000*lama;

else if(room==3){

jbiaya = 1200000*lama;

else if(room==4){

jbiaya = 1500000*lama;

printf("Hai %s\n",nama);

printf("Jumlah biaya yang harus anda bayarkan :%i",jbiaya);

}
File main.c
#include "header.h"

int main(){

int pil;

int gajipokok, status, anak, total;

int room, lama;

char nama[100];

printf("================ Selamat datang ================\n");

printf(" Berikut adalah menu aplikasinya \n");

printf("1. Menghitung Gaji\n");

printf("2. Booking Kamar Hotel\n");

printf("3. Keluar\n");

printf("================================================\n");

printf("Silahkan masukan pilihan anda :"); scanf("%d",&pil);

switch (pil)

case 1:

printf("========== Menghitung Gaji anda ==========");

printf("\nBerikut rincian Gaji Pokok:\n");

printf("Golongan 1 : Rp 2.000.000,00\n");

printf("Golongan 2 : Rp 3.000.000,00\n");

printf("Golongan 3 : Rp 4.000.000,00\n");

printf("Tunjangan yang didapat:\n");

printf("Tunjangan Rumah Tangga\n");

printf("Tunjangan anak \n");

printf("==========================================\n");

printf("ketikan nama anda :");scanf(" %s",&nama);


printf("\nstatus anda saat ini?\n");

printf("1. Single\n");

printf("2. Married\n");

printf("Masukan status anda :");scanf("%i",&status);

switch (status){

case 1:

printf("Golongan anda?(1/2/3) :"); scanf("%i",&gajipokok);

break;

case 2:

printf("Golongan anda?(1/2/3) :"); scanf("%i",&gajipokok);

printf("Jumlah anak anda :"); scanf("%i",&anak);

break;

menghitung_gaji(gajipokok,status,anak,total,nama);

break;

case 2:

printf("========== Booking Kamar Hotel ===========\n");

printf("Jenis & Harga hotel per-malamnya:\n");

printf("1. single Room : Rp 650.000,-/malam\n");

printf("2. Double Room : Rp 900.000,-/malam\n");

printf("3. single Room : Rp 1.200.000,-/malam\n");

printf("4. single Room : Rp 1.500.000,-/malam\n");

printf("==========================================\n");

printf("silahkan pilih jenis kamar hotel :"); scanf("%i",&room);

printf("Berapa Lama anda menginap? :");scanf("%i",&lama);

printf("Ketikan Nama anda :");scanf("%s",&nama);


case 3:
booking_kamar_hotel(room,lama,nama);
printf("\n");
break;
printf(" Thank U\n");

printf("=================== Have a nice day ====================");

You might also like