Menghitung_Gaji_Karyawan_Menggunakan_Struct_C# Posted by bangpemrograman on October 29, 2015 Get link Facebook X Pinterest Email Other Apps using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace return_gaji { class Program { struct karyawan { public int ph, GP, TJ; public string nama; public int Gaji_kotor() { return GP + TJ; } public int Besar_pajak() { return ((Gaji_kotor() * 5) / 100); } public int Gaji_bersih() { return (Gaji_kotor() - Besar_pajak()); } } static void Main(string[] args) { Console.Title = "bangpemrograman"; ConsoleKeyInfo key; karyawan tmp = new karyawan(); ulang: Console.Clear(); Console.Write("Nama Staf = "); tmp.nama = Console.ReadLine(); Console.WriteLine("Daftar Posisi dari Staf : "); Console.WriteLine("\t0 - General manager "); Console.WriteLine("\t1 - Branch Manager "); Console.WriteLine("\t2 - Kepala Bagian "); Console.WriteLine("\t3 - Staf Ahli "); Console.WriteLine("\t4 - Staf tetap "); Console.WriteLine("\t5 - Staf Tidak Teatap "); Console.Write("Posisi dari Staf bersangkutan <0-5> = "); key = Console.ReadKey(); switch (key.KeyChar) { case '0': Console.Write("\ninput besaran pph <%> = "); tmp.ph = Convert.ToInt32(Console.ReadLine()); tmp.GP =15000000; tmp.TJ =5000000; Console.WriteLine("\nBesar Gaji Kotor = {0}", tmp.Gaji_kotor()); Console.WriteLine("Besar Pajak <{0}%> = {1}",tmp.ph, tmp.Besar_pajak()); Console.WriteLine("Besar Gaji Bersih = {0}", tmp.Gaji_bersih()); break; case '1' : Console.Write("\ninput besaran pph <%> = "); tmp.ph = Convert.ToInt32(Console.ReadLine()); tmp.GP =12000000; tmp.TJ =4000000; Console.WriteLine("\nBesar Gaji Kotor = {0}", tmp.Gaji_kotor()); Console.WriteLine("Besar Pajak <{0}%> = {1}",tmp.ph, tmp.Besar_pajak()); Console.WriteLine("Besar Gaji Bersih = {0}", tmp.Gaji_bersih()); break; case '2' : Console.Write("\ninput besaran pph <%> = "); tmp.ph = Convert.ToInt32(Console.ReadLine()); tmp.GP =8000000; tmp.TJ =3000000; Console.WriteLine("\nBesar Gaji Kotor = {0}", tmp.Gaji_kotor()); Console.WriteLine("Besar Pajak <{0}%> = {1}",tmp.ph, tmp.Besar_pajak()); Console.WriteLine("Besar Gaji Bersih = {0}", tmp.Gaji_bersih()); break; case '3' : Console.Write("\ninput besaran pph <%> = "); tmp.ph = Convert.ToInt32(Console.ReadLine()); tmp.GP =6000000; tmp.TJ =2000000; Console.WriteLine("\nBesar Gaji Kotor = {0}", tmp.Gaji_kotor()); Console.WriteLine("Besar Pajak <{0}%> = {1}",tmp.ph, tmp.Besar_pajak()); Console.WriteLine("Besar Gaji Bersih = {0}", tmp.Gaji_bersih()); break; case '4' : Console.Write("\ninput besaran pph <%> = "); tmp.ph = Convert.ToInt32(Console.ReadLine()); tmp.GP =4000000; tmp.TJ =1000000; Console.WriteLine("\nBesar Gaji Kotor = {0}", tmp.Gaji_kotor()); Console.WriteLine("Besar Pajak <{0}%> = {1}",tmp.ph, tmp.Besar_pajak()); Console.WriteLine("Besar Gaji Bersih = {0}", tmp.Gaji_bersih()); break; case '5' : Console.Write("\ninput besaran pph <%> = "); tmp.ph = Convert.ToInt32(Console.ReadLine()); tmp.GP =2500000; tmp.TJ =0; Console.WriteLine("\nBesar Gaji Kotor = {0}", tmp.Gaji_kotor()); Console.WriteLine("Besar Pajak <{0}%> = {1}",tmp.ph, tmp.Besar_pajak()); Console.WriteLine("Besar Gaji Bersih = {0}", tmp.Gaji_bersih()); break; default : Console.WriteLine("\nPilih Posisi Sesui yang yang ada..!! enter untuk ulangi"); Console.ReadKey(); goto ulang; break; } Console.ReadKey(); } } } Comments
Comments
Post a Comment