Pegawai.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication2
{
    class Pegawai
    {
        string
nama;
        public string Nama
        {
            get
{ return nama; }
            set
{ nama = value; }
        }
        int
gapok;
        public int Gapok
        {
            get
{ return gapok; }
            set
{ gapok = value; }
        }
        public
Pegawai(string nama,Int32
gapok)
        {
            this.nama=nama;
            this.gapok=gapok;
        }
        public void profilPegawai()
        {
            Console.WriteLine("========JABATAN PEGAWAI=============");
            Console.WriteLine("Nama: {0}",nama);
            Console.WriteLine("Gaji Pokok:{0}",gapok);
        }
    }
}
Manager.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication2
{
    class Manager:Pegawai
    {
        int
tunjangan, totalgaji;
        public int Totalgaji
        {
            get
{ return totalgaji; }
            set
{ totalgaji = value; }
        }
        public int Tunjangan
        {
            get
{ return tunjangan; }
            set
{ tunjangan = value; }
        }
        public
Manager(string nama,Int32
gapok,Int32 tunjangan, Int32 totalgaji):base
(nama,gapok)
        {
            this.tunjangan
= tunjangan;
            this.totalgaji
= totalgaji;
        }
        public void profilManager()
        {
            Console.WriteLine("========JABATAN MANAGER=============");
            base.profilPegawai();
            Console.WriteLine("tunjangan:{0} ", tunjangan);
            Console.WriteLine("Total gaji sebelum lembur:{0} ",
tunjangan + Gapok);
        }
    }
}
Karyawan.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication2
{
    class Karyawan:Manager  
    {
        int
jamlembur, upahlemburperjam;
        public
Karyawan(string nama,Int32
gapok,Int32 tunjangan,Int32 totalgaji,int
jamlembur,Int32 upahlemburperjam):base (nama,gapok,tunjangan,totalgaji)
        {
            this.Nama
= nama;
            this.Gapok
= gapok;
            this.Tunjangan
= tunjangan;
            this.Totalgaji
= totalgaji;
            this.jamlembur
= jamlembur;
            this.upahlemburperjam
= upahlemburperjam;
    }
        public void profilKaryawan()
        {
            Console.WriteLine("========JABATAN KARYAWAN=============");
            base.profilManager();
            Console.WriteLine("Jamlembur :{0}",jamlembur);
            Console.WriteLine("Upah Jam Lembur:{0}",(jamlembur*upahlemburperjam));
        }
    }
}
Program.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication2
{
    class Program
    {
        static void Main(string[]
args)
        {
            Pegawai
p1 = new Pegawai("Dion", 50000000);
            p1.profilPegawai();
            Console.WriteLine("");
            Manager
m1 = new Manager("Dion", 100000000,3000000,4000000);
            m1.profilManager();
            Console.WriteLine("");
            Karyawan
k1 = new Karyawan("Dion", 1500000000, 400000000,
300000000, 24, 400000000);
            k1.profilKaryawan();
            Console.WriteLine("");
            Console.Read();
        }
    }
}

 
 










 
 
0 komentar:
Post a Comment
Note: only a member of this blog may post a comment.