Friday, August 9, 2019

Program C# "Menghitung Gaji"

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

namespace Hitungan_Gaji
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.Write("Input Gaji Pokok                         = Rp. ");
            int Gaji = int.Parse(Console.ReadLine());
            Console.Write("Input Tunjangan                          = Rp. ");
            int Tunj = int.Parse(Console.ReadLine());
            Console.Write("Input Bonus                              = Rp. ");
            int Bonus = int.Parse(Console.ReadLine());
            Console.Write("Input Hutang Pinjaman                    = Rp. ");
            int HutPin = int.Parse(Console.ReadLine());
            Console.Write("Input Pendapatan Tidak Kena Pajak (PTKP) = Rp. ");
            int PTKP = int.Parse(Console.ReadLine());
            Console.Write("Input Besaran PPh (%)                    = ");
            int PPh = int.Parse(Console.ReadLine());
            Console.WriteLine("");
            int BPJS   = (Gaji + Tunj)/100;
            int GajKot = Gaji + Tunj + Bonus - BPJS;
            int Pajak  = (GajKot - PTKP) *PPh;
            int GajBer = GajKot - HutPin - Pajak;
            Console.WriteLine("Besaran Iuran BPJS   = Rp. {0}",BPJS);
            Console.WriteLine("Besar Gaji Kotor     = Rp. {0}",GajKot);
            Console.WriteLine("Besar Pajak (5%)     = Rp. {0}",Pajak);
            Console.WriteLine("Besar Gaji Bersih    = Rp. {0}",GajBer);
            Console.ReadKey();
        }
    }
}



Membuat Bentuk Ketupat C#

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

namespace Bentuk_Segitiga
{
    class Program
    {
        static void Main(string[] args)
        {         
            Console.SetCursorPosition(5, 0);
            Console.BackgroundColor = ConsoleColor.Yellow;
            Console.Write(" ");
            Console.SetCursorPosition(4, 1);
            Console.BackgroundColor = ConsoleColor.Yellow;
            Console.Write(" ");
            Console.BackgroundColor = ConsoleColor.Blue;
            Console.Write("{0}", new string(' ', 1));
            Console.BackgroundColor = ConsoleColor.Yellow;
            Console.Write(" ");
            Console.SetCursorPosition(3, 2);
            Console.BackgroundColor = ConsoleColor.Yellow;
            Console.Write(" ");
            Console.BackgroundColor = ConsoleColor.Blue;
            Console.Write("{0}", new string(' ', 3));
            Console.BackgroundColor = ConsoleColor.Yellow;
            Console.Write(" ");
            Console.SetCursorPosition(2, 3);
            Console.BackgroundColor = ConsoleColor.Yellow;
            Console.Write(" ");
            Console.BackgroundColor = ConsoleColor.Blue;
            Console.Write("{0}", new string(' ', 5));
            Console.BackgroundColor = ConsoleColor.Yellow;
            Console.Write(" ");
            Console.SetCursorPosition(1, 4);
            Console.BackgroundColor = ConsoleColor.Yellow;
            Console.Write(" ");
            Console.BackgroundColor = ConsoleColor.Blue;
            Console.Write("{0}", new string(' ', 7));
            Console.BackgroundColor = ConsoleColor.Yellow;
            Console.Write(" ");
            Console.SetCursorPosition(0, 5);
            Console.BackgroundColor = ConsoleColor.Yellow;
            Console.Write(" ");
            Console.BackgroundColor = ConsoleColor.Blue;
            Console.Write("{0}",new string(' ',9));
            Console.BackgroundColor = ConsoleColor.Yellow;
            Console.Write(" ");
            Console.SetCursorPosition(0, 6);
            Console.BackgroundColor = ConsoleColor.Yellow;
            Console.Write("{0}",new string(' ',11));   
            Console.ReadKey();
        }
    }
}