Menghitung Data Pekerja di C#
namespace ConsoleAplication1
{
class program
{
static void Main(string[] args)
{
Console.Write("Jumlah Pekerja= ");
int n = int.Parse(Console.In.ReadLine());
data2 p1 = new data2(n);
p1.data1(n);
Console.Clear();
p1.cetak(n);
Console.ReadLine();
}
}
class data2
{
public int n;
string[] nama = new string[10];
int[] usia = new int[50];
string[] kelamin = new string[10];
int[] gaji = new int[50];
double[] upah = new double[50];
public data2(int n)
{
this.n = n;
}
public void data1(int n)
{
for (int i=1;i<=n;i++)
{
Console.Write("Inputkan Nama= ");
nama[i] = Console.In.ReadLine();
Console.Write("Inputkan Usia= ");
usia[i] = int.Parse(Console.In.ReadLine());
Console.Write("Inputkan Jenis kelamin= ");
kelamin[i] = Console.In.ReadLine();
Console.Write("Inputkan Gaji= ");
gaji[i] = int.Parse(Console.In.ReadLine());
Console.Write("Inputkan Jam Lembur= ");
upah[i] = double.Parse(Console.ReadLine());
Console.WriteLine();
}
}
public void cetak(int n)
{
Console.WriteLine();
Console.WriteLine("NAMA\t|USIA\t|KELAMIN\t|GAJI\t|\tUPAH LEMBUR\t|GAJI TOTAL|");
Console.Write("___________________________________________________________"+"\n");
for (int j = 1; j <= n; j++)
{
Console.Write(nama[j]+"\t");
Console.Write(usia[j]+"\t");
Console.Write(kelamin[j]+"\t");
Console.Write("Rp."+gaji[j]+"\t");
Console.Write("Rp."+(upah[j]*50000)+"\t");
Console.Write("Rp." + (gaji[j]+(upah[j] * 50000)));
Console.WriteLine();
}
Console.ReadLine();
}
}
}
Sabtu, November 12, 2011
|
Label:
C#
|
Langganan:
Posting Komentar (Atom)
Diberdayakan oleh Blogger.
Entri Populer
-
source code ini simple bgt deh,,,hhe.....,,mklum baru bljr.... namespace ConsoleApplication1 { class Program { static...
-
source codenya pasti mantap dah,,,ckckck... namespace ConsoleApplication1 { class Program { static void Main(string[]...
-
source code program persegi bintang pada c++; #include <iostream.h> #include <conio.h> int main() { int ukuran; do ...
Buku Tamu
Arsip Blog
About Me

- Ijal Ferdi
- there is no something special about me,,, but this blog is so special for me......
0 komentar:
Posting Komentar