0% found this document useful (0 votes)
48 views

Array

The document contains code for a C# program that manages employee payroll data. It initializes arrays to store employee names, salaries, allowances, and total pay. It then prints a payroll report to the console showing the employee name, allowances, and total pay for each employee. It also calculates and prints the total payroll amount.
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
48 views

Array

The document contains code for a C# program that manages employee payroll data. It initializes arrays to store employee names, salaries, allowances, and total pay. It then prints a payroll report to the console showing the employee name, allowances, and total pay for each employee. It also calculates and prints the total payroll amount.
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 5

1.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ARRAY
{
class Program
{
static void Main(string[] args)
{

int[] kode = new int[100];

int[] lama = new int[100];

double[] harga = new double[100];

double[] total = new double[100];

string[] jenis = new string[20];

int i, n = 0;

Console.Write("Masukan Jumlah Input: ");

n = int.Parse(Console.ReadLine());

for (i = 1; i <= n; i++)

Console.WriteLine(" Masukan Kamar ke-" +i);

Console.Write("\t Masukan Kode Kamar : ");

kode[i] = int.Parse (Console.ReadLine());

Console.Write("\t Masukan Lama Inap : ");

lama[i] = int.Parse (Console.ReadLine());

if (kode[i] == 1)

{
harga[i] = 100000;

jenis[i] = " VIP ";

else if (kode[i] == 2)

harga[i] = 200000;

jenis[i] = "Double";

else

jenis[i] = " kode kamar salah !";

total[i] = lama[i] * harga[i];

Console.Clear();

Console.WriteLine("|=========================|");

Console.WriteLine("\nFakuktas Teknologi Komunikasi dan Informatika ");


Console.WriteLine("\nProgram Studi Teknik Informatika ");
Console.WriteLine("\nUNIVERSITAS NASIONAL ");

Console.WriteLine("|=========================|");

Console.WriteLine("No | Kode Kamar | Jenis Kamar | Harga | Lama Inap | Total


Harga |");

Console.WriteLine("---------------------------");

for (i = 1; i <= n; i++)

Console.WriteLine(i + " \t " + kode[i] + " \t " + jenis[i] + " \t " +


harga[i] +" " + lama[i] + "\t " + total[i] + " ");

Console.WriteLine("===========================");

Console.WriteLine(" TERIMA KASIH ");

Console.Read();
}

}
2.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApplication2
{
class Program
{
static void Main(string[] args)
{

Console.WriteLine("===================================================================");
Console.WriteLine("\nFakultas Teknologi Komunikasi dan Informatika");
Console.WriteLine("\nprogram studi system informasi");
Console.WriteLine("\nUNIVERSITAS NASIONAL");

Console.WriteLine("===================================================================");

Console.WriteLine("-------------------------------------------------------------------");
Console.WriteLine();
Console.WriteLine(" DATAKARYAWAN ");
Console.WriteLine("PT.SEJAHTERA TECHNOLOGY");
Console.WriteLine();
Console.WriteLine("No | nama karyawan |tunjangan jabatan | tunjangan
pendidikan | Honor lembur | Gaji Bersih |");
for (int i = 0; i <= 2; i = +1)
{
string[] nama = new string[3] { "sopiyan", "udin ", "bagus " };
double[] tunjangan_jabatan = new double[3] { 8000000, 6000000, 7000000 };
double[] tunjangan_pendidikan = new double[3] { 2000000, 1000000, 5000000
};
double[] gaji = new double[100];
double[] gajibersih = new double[100];
double total;
for (int n = 0; n <= 2; n++)
{

gajibersih[i + n] = tunjangan_pendidikan[i + n] + tunjangan_jabatan[i


+ n];

Console.WriteLine("----------------------------------------------------------------------
--------------------------");
Console.WriteLine(n + 1 + " " + nama[i + n] + "\t\t " +
tunjangan_jabatan[i + n] + "\t\t " + tunjangan_pendidikan[i + n] + " \t 0 \t" +
gajibersih[i + n]);
}

Console.WriteLine("----------------------------------------------------------------------
--------------------------");
total = gajibersih[0] + gajibersih[1] + gajibersih[2];
Console.WriteLine("total gaji yang dikeluarkan :" + total);
Console.ReadLine();
}
}
}
}

You might also like