Thursday, April 28, 2016

Belajar Pemrogaman Visual

1)      Mengkonversi Kecepatan
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace no1
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.Write("input kecepatan dalam km/jam : ");
            int a = Convert.ToInt32(Console.ReadLine());
            double b = a / 3.6;
            Console.WriteLine("besaran dalam m/s     = {0}", b);
            double c = a * 0.62137;
            Console.WriteLine("besaran dalam mil/jam = {0}", c);
            Console.ReadKey();

        }
    }
}

HASIL:

2)      Mengkonversi Suhu
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace no2
{
    class Program
    {
        static void Main(string[] args)
        {
            int c;
            double f, k, r;
            Console.Write("berapa suhu dalam celcius = ");
            c = Convert.ToInt32(Console.ReadLine());
            f = c * 1.8 + 32;
            k = c + 273;
            r = 0.8 * c;
            Console.WriteLine("\nbesaran dalam reamur     = {0}", r);
            Console.WriteLine("besaran dalam fahrenheit = {0}", f);
            Console.WriteLine("besaran dalam kelvin     = {0}", k);

            Console.ReadKey();

        }
    }
}

HASIL:

3)      Menghitung Volume Tabung dan Kerucut
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace no3
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.Write("input besaran jari-jar(cm)  : ");
            int a = Convert.ToInt32(Console.ReadLine());
            Console.Write("tinggi(cm)                  : ");
            int b = Convert.ToInt32(Console.ReadLine());
            int c = a * a * b;
            double d = 0.333 * 3.14 * a * a * b;
            Console.WriteLine("\nvolume tabung        : {0} cm3", c);
            Console.WriteLine("volume kerucut       : {0} cm3", d);

            Console.ReadKey();

        }
    }
}

HASIL:

4)      Menghitung Total Pembelian
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace no4
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.Write("input harga barang / unit : Rp. ");
            int a = Convert.ToInt32(Console.ReadLine());
            Console.Write("jumlah unit               : ");
            int b = Convert.ToInt32(Console.ReadLine());
            Console.Write("besar potongan            : ");
            double c = double.Parse(Console.ReadLine());
            double d = c / 100;
            double e = a * d;
            double f = a * b;
            f = f - (f * d);

            Console.Write("\ntotal pembayaran          : Rp. {0}", f);

            Console.ReadKey();

        }
    }
}

HASIL:

5)      Menghitung Gaji
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace no5
{
    class Program
    {
        static void Main(string[] args)
        {
            int gapok, tunjangan, bonus, ptkp, pph, gakot, pajak, gaber;

            Console.Write("Input Gaji Pokok                        =Rp. ");
            gapok = Convert.ToInt32(Console.ReadLine());
            Console.Write("Input Tunjangan                         =Rp. ");
            tunjangan = Convert.ToInt32(Console.ReadLine());
            Console.Write("Input Bonus                             =Rp. ");
            bonus = Convert.ToInt32(Console.ReadLine());
            Console.Write("Input Pendapatan Tidak Kena Pajak(PTKP) =Rp. ");
            ptkp = Convert.ToInt32(Console.ReadLine());
            Console.Write("Input pph(%)                            =Rp. ");
            pph = Convert.ToInt32(Console.ReadLine());

            gakot = gapok + tunjangan + bonus;
            pajak = (gakot - ptkp) * pph / 100;
            gaber = gakot - pajak;
            Console.WriteLine();
            Console.WriteLine("Besar Gaji Kotor  =Rp. {0} ", gakot);
            Console.WriteLine("Besar Pajak (5%)  =Rp. {0} ", pajak);
            Console.WriteLine("Besar Gaji Bersih =Rp. {0} ", gaber);

            Console.ReadKey();

        }
    }
}

HASIL:

0 comments:

Post a Comment

Cara Membersihkan Cache Smartphone

Assalamu’alaikum Wr. Wb. Gimana kabarnya kawan? Semoga baik selalu. Sebenarnya bingung sih mau nulis materi apa, eh tiba2 kepikiran cache. ...