Koding C# Menentukan Gaji Pegawai Dengn Menggunakn Login
using System;
usingSystem.Collections.Generic;
usingSystem.Linq;
usingSystem.Text;
namespace ConsoleApplication7
{
classProgram
{
staticvoid Main(string[]
args)
{
string username, pass;
intpilih;
Console.WriteLine("*********************");
Console.WriteLine("
Please Login");
Console.WriteLine("---------------------");
Console.WriteLine("");
Console.WriteLine("%%%%%%%%%%%%%%%%%%%%%");
Console.Write("username : ");
username = Console.ReadLine();
Console.Write("pass : ");
pass = Console.ReadLine();
Console.WriteLine("____________________________");
Console.WriteLine("*******************");
if (username == "HIDAYAT
MAULANA"&& pass == "141100088")
{
Console.WriteLine("NAMA :
HIDAYAT MAULANA");
Console.WriteLine("BP : 141100088");
Console.WriteLine();
Console.WriteLine("PilihGolongan:");
Console.WriteLine("1.
Golongan A");
Console.WriteLine("2.
Golongan B");
Console.WriteLine("3.
Golongan C");
Console.WriteLine("4.
Golongan D");
Console.Write("MasukkanPilihan
:");
pilih = int.Parse(Console.ReadLine());
switch (pilih)
{
case 1: { golongan_A(); }
break;
case 2: { golongan_B(); }
break;
case 3: { golongan_C(); }
break;
case 4: { golongan_D(); }
break;
default: { Console.WriteLine("Golongan Salah!"); }
break;
}
}
else
{
Console.WriteLine("
username dan pass andasalah ");
}
Console.ReadLine();
}
staticvoidgolongan_A()
{
stringnama;
double jam, gaji, pajak, lembur, total;
Console.Write("NamaPegawai
: ");
nama = Console.ReadLine();
Console.Write("Jam : ");
jam = double.Parse(Console.ReadLine());
gaji = 0;
pajak = 0;
lembur = 0;
total = 0;
if (jam <= 48)
{
gaji = (jam * 50000) * 4;
}
else
{
gaji = 48 * 50000;
lembur = (jam - 48) * 30000;
}
pajak = (gaji + lembur) * (0.5 / 100);
total = gaji + lembur - pajak;
Console.WriteLine("GajiPokok
: " + gaji);
Console.WriteLine("Lembur : " + lembur);
Console.WriteLine("Pajak : " + pajak);
Console.WriteLine("Total
gaji : " + total);
}
staticvoidgolongan_B()
{
stringnama;
double jam, gaji, pajak, lembur, total;
Console.Write("NamaPegawai
: ");
nama = Console.ReadLine();
Console.Write("jam : ");
jam = double.Parse(Console.ReadLine());
gaji = 0;
pajak = 0;
lembur = 0;
total = 0;
if (jam <= 48)
{
gaji = (jam * 60000) * 4;
}
else
{
gaji = 48 * 60000;
lembur = (jam - 48) * 30000;
}
pajak = (gaji + lembur) * (0.5 / 100);
total = gaji + lembur - pajak;
Console.WriteLine("*******************");
Console.WriteLine("GajiPokok
: " + gaji);
Console.WriteLine("Lembur : " + lembur);
Console.WriteLine("Pajak : " + pajak);
Console.WriteLine("Total
gaji : " + total);
Console.WriteLine("*******************");
}
staticvoidgolongan_C()
{
stringnama;
double jam, gaji, pajak, lembur, total;
Console.WriteLine("*******************");
Console.Write("NamaPegawai
: ");
nama = Console.ReadLine();
Console.Write("jam : ");
Console.WriteLine("*******************");
jam = double.Parse(Console.ReadLine());
gaji = 0;
pajak = 0;
lembur = 0;
total = 0;
if (jam <= 48)
{
gaji = (jam * 70000) * 4;
}
else
{
gaji = 48 * 70000;
lembur = (jam - 48) * 30000;
}
pajak = (gaji + lembur) * (0.5 / 100);
total = gaji + lembur - pajak;
Console.WriteLine("*******************");
Console.WriteLine("GajiPokok
: " + gaji);
Console.WriteLine("Lembur : " + lembur);
Console.WriteLine("Pajak : " + pajak);
Console.WriteLine("Total
gaji : " + total);
Console.WriteLine("*******************");
}
staticvoidgolongan_D()
{
stringnama;
double jam, gaji, pajak, lembur, total;
Console.WriteLine("*******************");
Console.Write("NamaPegawai
: ");
nama = Console.ReadLine();
Console.Write("jam : ");
Console.WriteLine("*******************");
jam = double.Parse(Console.ReadLine());
gaji = 0;
pajak = 0;
lembur = 0;
total = 0;
if (jam <= 48)
{
gaji = (jam * 80000) * 4;
}
else
{
gaji = 48 * 80000;
lembur = (jam - 48) * 30000;
}
pajak = (gaji + lembur) * (0.5 / 100);
total = gaji + lembur - pajak;
Console.WriteLine("*******************");
Console.WriteLine("GajiPokok
: " + gaji);
Console.WriteLine("Lembur : " + lembur);
Console.WriteLine("Potongan : " + pajak);
Console.WriteLine("Total
gaji : " + total);
Console.WriteLine("*******************");
}
}
}
0 komentar: