Sunday 8 April 2012

Tugas 3

Saya akan menjelaskan program sederhana yang saya buat, program ini digunakan pegawai ford yang ingin memberikan atau mengecek VIN (Vehicle Identification Number) jadi jika ingin menggunakan program ini pegawai harus tau pass word dan ID Admin.

Saat awal menjalankan program akan muncul form login seperti ini
lalu kita masukan password dan tekan button enter
jika salah hasilnya akan
namun jika benar akan seperti ini
setelah itu form 1 akan hilang lalu muncul form 2 dengan tampilan
diatas kita dapat memilih dimana kendaraan tersebut di produksi dengan 3 pilihan karena hanya negara tersebut asal mobil ford
lalu kita memilih model mobil dan tipenya

setelah itu kita pilih tahun dan bulan produksi dan menginput seuence numbernya (4 digit)


setelah semuanya terinput dengan benar tekan Generate lalu XXX yang dibawah akan berubah menjadi VIN mobil tersebut
lalu jika ingin mengulang tekan reset makan form akan kembali seperti awal
lalu tekan log out jika ingin keluar lalu form akan kembali ke form log in

jika sudah selesai tekan exit maka akan muncil dialog box
tekan OK untuk keluar dan cancel untuk masuk kembali :D sekian

berikut ini source codenya

Form1:
Public Class Form1

    Private Sub Enter_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Enter.Click
        If ID.Text = "admin" And Pass.Text = "rizky" Then
            MsgBox("Selamat datang admin")
            ID.Text = ""
            Pass.Text = ""
            ID.Focus()
            Form2.Show()
            Me.Hide()
        Else
            MsgBox("ID atau Password salah")
            ID.Text = ""
            Pass.Text = ""
            ID.Focus()
        End If
    End Sub

    Private Sub Keluar_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Keluar.Click
        Dim y As Integer
        y = MsgBox("Apa anda ingin keluar?", MsgBoxStyle.OkCancel + MsgBoxStyle.Question, "konfirmasi")
        If y = vbOKCancel Then
            Me.Close()
        End If
    End Sub
End Class

Form2:
Public Class Form2

    Private Sub Form2_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Dim x, y As Integer
        For x = 2010 To 2012
            year.Items.Add(x)
        Next
        For y = 1 To 12
            month.Items.Add(MonthName(y))
        Next
    End Sub

    Private Sub Generate_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Generate.Click
        If C1.Text = "Germany" Then
            L1.Text = "MNB"
        ElseIf C1.Text = "Thailand" Then
            L1.Text = "RHD"
        ElseIf C1.Text = "USA" Then
            L1.Text = "UMC"
        End If
        If C2.Text = "Fiesta" Then
            L2.Text = "J"
        ElseIf C2.Text = "Focus" Then
            L2.Text = "F"
        ElseIf C2.Text = "Mustang" Then
            L2.Text = "M"
        End If
        If C3.Text = "Hatchback" Then
            L3.Text = "J"
        ElseIf C3.Text = "Sedan" Then
            L3.Text = "S"
        End If
        If year.Text = "2010" Then
            L4.Text = "A"
        ElseIf year.Text = "2011" Then
            L4.Text = "B"
        ElseIf year.Text = "2012" Then
            L4.Text = "C"
        End If
        If month.Text = "January" Then
            L5.Text = "J"
        ElseIf month.Text = "February" Then
            L5.Text = "F"
        ElseIf month.Text = "March" Then
            L5.Text = "M"
        ElseIf month.Text = "April" Then
            L5.Text = "L"
        ElseIf month.Text = "May" Then
            L5.Text = "Y"
        ElseIf month.Text = "June" Then
            L5.Text = "E"
        ElseIf month.Text = "July" Then
            L5.Text = "U"
        ElseIf month.Text = "August" Then
            L5.Text = "G"
        ElseIf month.Text = "September" Then
            L5.Text = "B"
        ElseIf month.Text = "October" Then
            L5.Text = "O"
        ElseIf month.Text = "November" Then
            L5.Text = "A"
        ElseIf month.Text = "December" Then
            L5.Text = "D"
        End If
        L6.Text = T1.Text
    End Sub

    Private Sub Reset_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Reset.Click
        C1.ResetText()
        C2.ResetText()
        C3.ResetText()
        month.ResetText()
        year.ResetText()
        T1.Text = ""
        L1.Text = "X X X"
        L2.Text = "X"
        L3.Text = "X"
        L4.Text = "X"
        L5.Text = "X"
        L6.Text = "X X X X"
        C1.Focus()
    End Sub

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        MsgBox("Log Out")
        Form1.Show()
        Me.Close()
    End Sub
End Class

Saturday 17 March 2012

Contoh Program Sederhana VB ( Fungsi IF, String, Input Box)

Program Kasir Toko Sederhana

Di dalam ini program yang berisikan inputbox fungsi if dan fungsi string

ini ada lah tampilan awal pada saat program dijalankan untuk memasukan kode barang anda bisa mengklik input kode lalu akan muncul
anda dapat memasukan barang dengan ketemtuan kode produk lalu harga contoh m1500 itu menandakan bahwa produk yang dibeli adalah makanan dengan harga 1500 USD

setelah selesai menginput tekan ok lalu akan muncul tampilan
lalu anda dapat memasukan jumlah barang yang di pesan
setelah menginput tekan tombol hitung lalu aplikasi akan menghitung total yang anda pesan dan yang anda bayarkan

setelah selesai menggukan aplikasi anda bisa mengklik selesai lalu akan muncul confirmation box spt
tekan yes untuk keluar dari aplikasi :D
terima kasih telah menggunakan aplikasi ini
berikut ini source code program ini

Public Class Form1

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim v As Integer
        If Jumlah.Text = 0 Then
            jumlahh.Text = "Jumlah Yang Dipesan Anda Tidak Memesan Apa-apa."
        ElseIf Jumlah.Text = 1 Then
            jumlahh.Text = "Jumlah Yang Dipesan Anda Memesan 1 Buah."
        Else
            jumlahh.Text = "Jumlah Yang Dipesan Anda Memesan " & Jumlah.Text & " Buah."
        End If
        v = (TextBox3.Text * Jumlah.Text)
        total.Text = Strings.FormatCurrency(v)

    End Sub

    Private Sub TextBox1_LostFocus(ByVal sender As Object, ByVal e As System.EventArgs) Handles Jumlah.LostFocus
        Dim x As String
        Dim z As Integer
        z = Strings.Mid(Textbox1.Text, 2)
        TextBox3.Text = Strings.FormatCurrency(z)
        x = Strings.Left(Textbox1.Text, 1)
        If x = "M" Then
            TextBox2.Text = "Makanan"
        ElseIf x = "E" Then
            TextBox2.Text = "Elektronik"
        ElseIf x = "P" Then
            TextBox2.Text = "Pakaian"
        Else
            TextBox2.Text = "Kode Salah"
        End If
    End Sub

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        Dim c As String
        c = InputBox("Masukan Kode Produk (M,E,P) & Masukan Kode Harga ")
        Textbox1.Text = Strings.UCase(c)
    End Sub

    Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
        Dim d As Integer
        d = MsgBox("Anda Sudah Selesai ?", MsgBoxStyle.YesNo + MsgBoxStyle.Question, "konfirmasi")
        If d = vbYes Then
            Me.Close()
        End If
    End Sub
End Class
Klik disini untuk melihat blog saya

Saturday 3 March 2012

Contoh Program Sederhana VB ( Cara Perhitungan Bunga Wesel)

Program Menghitung Wessel 
 
Program ini dibuat untuk memenuhi salah satu tugas matakuliah PB
dalam kesempatan ini saya membuat program dengan fungsi menghitung wessel

Berikut ini Screenshot program tersebut:

Ini adalah tampilan awal pada saat program di jalankan.. kursor berada di kolom awal yaitu jumlah wesel
program ini terdiri dari 3 button dengan fungsi berbeda
reset = mengapus semua inputan
hitung = menjalankan program sehingga dapat terhitung oleh komputer data yang telah diinput
selesai = tombol untuk keluar dari form


 Lalu masukan data data yang harus diinput saya memberikan contoh seperti diatas

Untuk menjalankan fungsi program pencet button hitung

Setelah button dipencet maka akan muncul jumlah yang harus di bayar perusahaan pada saat wessel jatuh tempo 
Setelah semua data muncul jika ingin mengulang program tekan button reset agar semua inputan dan hasil perhitungan kembali ke posisi clear.

Maka akan kembali ketampilan awal dan kursor berada di jumlah wesel
jika ingin keluar maka anda bisa menekan tombol selesai
Lalu akan muncul message box ok button seperti diatas lalu klik ok untuk keluar dari form..

Berikut Ini coding yang saya gunakan untuk program sederhana ini


Jika anda ingin mencoba program ini silakan Download dari link berikut
http://www.4shared.com/rar/XhPuRTnj/Perhitungan_Wesel.html?refurl=d1url

Sekian dan terimakasih :D


Thursday 24 November 2011

Script Calculator di C++ :D

#include<iostream.h>
#include<conio.h>
#include<math.h>
void main()
{
    long double x,y;
    char ch,ar;
    do
       {
    clrscr();
    cout<<"
            *WELCOME TO CALCULATOR*
";
    cout<<"
This is a Calculator containing the following functions

Addition
 Subtraction
 Multiplication
 Division
 Percentage

Power
";
    cout<<"
Type
 [+] for Addition
 [-] for Subtraction
 [*] for
Multiplication
 [/] for Division
 [%] for Percentage
 [^] for
Power
";
    cout<<"
Enter Function To use =  ";
    cin>>ch;
    cout<<(char)7;
    cout<<endl;
    //For Addition
       if(ch=='+')
        {
        clrscr();
        cout<<"
You are using Addition
";
        cout<<"
Enter First Number= ";
        cin>>x;

        cout<<"
Enter Second Number= ";
        cin>>y;

        cout<<"
Your answer is ";
        cout<<x+y;
        cout<<(char)7;
        }
    // For Subtraction
     if(ch=='-')
        {
        clrscr();
        cout<<"
You are using Subtraction
";
        cout<<"
Enter First Number= ";
        cin>>x;
        cout<<"
Enter Second Number= ";
        cin>>y;
        cout<<"
Your answer is ";
        cout<<x-y;
        cout<<(char)7;
        }
    // For Multiplication
     if(ch=='*')
        {
        clrscr();
        cout<<"
You are using Multiplication
";
        cout<<"
Enter First Number= ";
        cin>>x;
        cout<<"
Enter Second Number= ";
        cin>>y;
        cout<<"
Your answer is ";
        cout<<x*y;
        cout<<(char)7;
        }
    // For Division
     if(ch=='/')
        {
        clrscr();
        cout<<"
You are using Division
";
        cout<<"
Enter First Number= ";
        cin>>x;
        cout<<"
Enter Second Number= ";
        cin>>y;
        cout<<"
Your answer is ";
        cout<<x/y;
        cout<<(char)7;
        }
        // For Percentage
     if(ch=='%')
        {
        clrscr();
        cout<<"
You are using Percentage
";
        cout<<"
Enter Number= ";
        cin>>x;
        cout<<"
Enter Percentage= ";
        cin>>y;
        cout<<"
Your answer is ";
        cout<<y/100*x;
        cout<<(char)7;
    }
        //For Power
    if(ch=='^')
        {
        clrscr();
        cout<<"
You are using Power
";
        cout<<"
Enter Number= ";
        cin>>x;
        cout<<"
Enter Power= ";
        cin>>y;
        cout<<"
Your answer is ";
        cout<<pow(x,y);
        cout<<(char)7;
    }
        cout<<endl;
        cout<<"
Do you want to continue..Y/N?";
        cin>>ar;

        }
        while(ar=='Y'|| ar=='y');
        if(ar=='N' || ar=='n')
        {
            cout<<"
Thankyou for using this Calculator.Good Bye.
";
            cout<<"
Press any key to exit.......";
        }

        getch();
        cout<<(char)7;

}