-->
Last News
Menu
Home
Last News
Mobile
Home
C++
Contoh program c++ untuk menentukan gaji menggunakan percabagan(if)
Contoh program c++ untuk menentukan gaji menggunakan percabagan(if)
Share to Facebook
Share to X
#include <conio.h>
#include <iostream.h>
#include <stdio.h>
# define pajak 0.05
main(){
int gaji_pokok, tjg_i, total_gaji, ja, kelamin, status, ta, gaji, pend, jk,st;
cout<<" Pilihan Pendidikan"<<endl;
cout<<" [1] pendidikan d3"<<endl;
cout<<" [2] pendidikan s1"<<endl;
cout<<" [3] pendidikan s2"<<endl;
cout<<"==============================="<<endl;
cout<<" Pilihan gender"<<endl;
cout<<" [1] laki-laki"<<endl;
cout<<" [2] perempuan"<<endl;
cout<<"==============================="<<endl;
cout<<" Pilihan Status"<<endl;
cout<<" [1] menikah"<<endl;
cout<<" [1] belum menikah"<<endl;
cout<<"==============================="<<endl;
cout<<" Masukkan pendidikan karyawan :";cin>>pend;
switch(pend){
case 1:
gaji_pokok = 500000;
break;
case 2:
gaji_pokok = 750000;
break;
case 3:
gaji_pokok = 1000000;
break;
default:
gaji_pokok = 0;
}
cout<<" Gaji pokok anda : "<<gaji_pokok<<endl;
cout<<"==============================="<<endl;
cout<<" Masukkan jk karyawan : ";cin>>jk;
cout<<" Masukkan status : ";cin>>st;
switch (jk) {
case 1:
kelamin = 1;
break;
case 2:
kelamin = 2;
break;
default:
kelamin = 3;
}
switch (st) {
case 1:
status = 1;
break;
case 2:
status = 2;
break;
default:
status = 3;
}
if ((kelamin == 1) && (status == 1) )
{ cout<<" Masukkan jumlah anak :" ;cin>>ja;
if (ja == 1)
{tjg_i = 500000;
ta = 200000; }
else
{
tjg_i = 500000;
ta = 400000; }
}
else
{
tjg_i = 0;
ta = 0;
}
gaji = gaji_pokok + tjg_i + ta;
cout<<" Anda mendapat tunjangan istri sebesar : "<<tjg_i<<endl;
cout<<" Anda mendapat tunjangan Anak sebesar : "<<ta<<endl;
cout<<"==============================="<<endl;
cout<<" Gaji anda : "<< gaji<<endl;
cout<<" Pajak 5% dari tolal gaji"<<endl;
total_gaji = (gaji_pokok + tjg_i + ta)-((gaji_pokok + tjg_i + ta)*pajak) ;
cout<<" Maka gaji bersih anda(setelah dipotong pajak) : "<<total_gaji;
getch(); }
hasil program akan tampak seperti berikut:
semoga bermanfaat..
Newer Post
Older Post
Related Post
https://goraps.com/fullpage.php?section=General&pub=549254&ga=g
Popular Posts
Google Alert - Las Vegas shooting
Las Vegas shooting As-it-happens update ⋅ September 26, 2020 NEWS New Las Vegas police t...
Google Alert - Tesla
Tesla As-it-happens update ⋅ September 18, 2020 NEWS Tesla battery day bingo pv m...
Google Alert - Tesla
Tesla As-it-happens update ⋅ September 26, 2020 NEWS Tesla's bumpy road to today'...
Recent Posts
Blog Archive
November 2020
(1484)
October 2020
(2675)
September 2020
(2703)
August 2020
(3255)
July 2020
(2988)
June 2020
(2644)
May 2020
(2313)
April 2020
(3447)
March 2020
(7365)
February 2020
(11650)
January 2020
(18086)
December 2019
(16887)
November 2019
(12182)
October 2019
(17332)
September 2019
(16072)
August 2019
(16404)
July 2019
(17048)
June 2019
(14038)
May 2019
(17745)
April 2019
(17043)
March 2019
(14861)
February 2019
(14600)
January 2019
(7593)
December 2018
(9651)
November 2018
(3837)
October 2018
(6660)
September 2018
(10307)
August 2018
(4519)
July 2018
(1045)
September 2017
(27)
August 2017
(6)
June 2017
(5)
April 2017
(9)
February 2017
(2)
January 2017
(10)
December 2016
(3)
November 2016
(1)
October 2016
(3)
September 2016
(3)
December 2014
(1)
November 2014
(5)
April 2014
(7)
March 2014
(6)
February 2014
(1)
January 2014
(7)