Sunday, May 31, 2015

UAS Konsep Pemograman TSI B - Vokasi



Program Pembelian Tiket
"SARASVATI MOVIES FESTIVAL 2015"



Tampak pada form home (form depan ketika program dijalankan)
Ada 3 opsi ketika pembeli ingin mengklik tombol button:
1.Movies
2. Purchase
3. Exit


Ketika yang di klik adalah ''movies"
Yang pertama keluar adalah film yang akan diputar di "Sarasvati Film Festival"
Ketika mengklik radio buttonnya maka setiap pembeli yang penasaran akan film tersebut, karena  penonton diberikan informasi sekilas cerita tentang film yang akan diputar







Nah, kemudian jika pembeli kembali ke form home dan mengklik tombol "Purchase maka", form pembelian akan muncul

Para pelanggan wajib mengisi form, mulai dari:
1.Number Purchase tiket
2.Full Name/ Credit Card
3.Select Movie:
a.Pitch Perfect 2
b.Avengers
c.Cobain : Montage of Heck
d.Tommorowland

(Nah ketika memilih movie yg di klik maka akan keluar informasi di combo box dari mulai harga per tiket, hingga venue yang disediakan)

4. Date Purchase

5.Ketika ingin membeli jumlah tiket hanya mengisi jumlah pada Numerik adult/ student
Setelah sudah memilih, maka otomatis di tabel paling bawah otomatis akan keluar quantitas , harga, kemudian total dari harga beli.

6.Klik pay


Ketika Sudah mengklik pay 
Maka akan keluar dialogue



Dan ketika mengklik list akan keluar informasi di list box


Nah ketika pelanggan tidak mengisi number purchase ticket maka, ada dialogue pemberitahuan 
"Number purchase Ticket wajib diisi, ini fungsinya mengigatkan pelanggan


Sekian Program pembelian tiket Saravati Movies Festival




 fungsi aritmatika, condition if, elseIf, for, while, Case, Class (Function/method, Procedure) , Array.    

SOURCE CODE




FORM 1

Public Class Form1

    Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
        Dim tanggal As Integer
        tanggal = 1
        Do
            ComboBoxDate.Items.Add(tanggal)
            tanggal = tanggal + 1
        Loop Until tanggal >= 32

        For b = 2014 To 2015
            ComboBoxYear.Items.Add(b)
        Next

        ComboBoxMonth.Items.Add("January")
        ComboBoxMonth.Items.Add("February")
        ComboBoxMonth.Items.Add("March")
        ComboBoxMonth.Items.Add("April")
        ComboBoxMonth.Items.Add("May")
        ComboBoxMonth.Items.Add("June")
        ComboBoxMonth.Items.Add("July")
        ComboBoxMonth.Items.Add("August")
        ComboBoxMonth.Items.Add("September")
        ComboBoxMonth.Items.Add("October")
        ComboBoxMonth.Items.Add("November")
        ComboBoxMonth.Items.Add("December")

        'PictureBox1.Image = Image.FromFile("saras.jpg")

        ComboBoxBand.Items.Add("Pitch Perfect 2")
        ComboBoxBand.Items.Add("Avengers")
        ComboBoxBand.Items.Add("Cobain")
        ComboBoxBand.Items.Add("Tommorowland")

        'TextBoxBandDesc.ReadOnly = True
        TextBoxPrice.ReadOnly = True
        TextBoxStudentPrice.ReadOnly = True
        TextBox2.ReadOnly = True
        TextBoxQuantity.ReadOnly = True
        TextBoxPrice.ReadOnly = True
        TextBoxStudentQuantity.ReadOnly = True
        TextBoxStudentPrice.ReadOnly = True
        TextBoxTotal.ReadOnly = True
        TextBoxQuantity.Text = 0
        TextBoxPrice.Text = 0
        TextBoxStudentQuantity.Text = 0
        TextBoxStudentPrice.Text = 0
        TextBoxTotal.Text = 0



    End Sub


    Private Sub ComboBoxBand_SelectedIndexChanged(sender As Object, e As EventArgs) Handles ComboBoxBand.SelectedIndexChanged
        Dim selectband As String
        selectband = ComboBoxBand.Text

        Dim price() As Integer = {250, 300, 200, 300}
        Dim studentprice() As Integer = {200, 250, 150, 250}

        Select Case ComboBoxBand.SelectedItem
            Case "Pitch Perfect 2"
                TextBoxPrice.Text = price(0)
                TextBoxStudentPrice.Text = studentprice(0)
                TextBox2.Text = " VENUE:                                                Lap. Tennis Indoor Senayan                            at 10.00 pm                        HTM:                                                    250 IDR (ADULT)                               200 IDR (student) "
            Case "Avengers"
                TextBoxPrice.Text = price(1)
                TextBoxStudentPrice.Text = studentprice(1)
                TextBox2.Text = " VENUE:                                                Lap. Tennis Indoor Senayan                            at 08.00 pm                        HTM:                                                    300 IDR (ADULT)                                250 IDR (student) "

            Case "Cobain"
                TextBoxPrice.Text = price(2)
                TextBoxStudentPrice.Text = studentprice(2)
                TextBox2.Text = " VENUE:                                                Lap. Tennis Indoor Senayan                            at 07.00 pm                        HTM:                                                    200 IDR (ADULT)                               150 IDR (student) "

            Case "Tommorowland"
                TextBoxPrice.Text = price(3)
                TextBoxStudentPrice.Text = studentprice(3)
                TextBox2.Text = " VENUE:                                                Lap. Tennis Indoor Senayan                            at 06.00 pm                        HTM:                                                    300 IDR (ADULT)                                250 IDR (student)"

        End Select

        Call Hitung()
    End Sub


    Private Sub NumericUpDownStudent_ValueChanged(sender As Object, e As EventArgs) Handles NumericUpDownStudent.ValueChanged
        TextBoxStudentQuantity.Text = NumericUpDownStudent.Value
        Call Hitung()
    End Sub

    Private Sub NumericUpDownAdult_ValueChanged(sender As Object, e As EventArgs) Handles NumericUpDownAdult.ValueChanged
        TextBoxQuantity.Text = NumericUpDownAdult.Value
        Call Hitung()
    End Sub


    Private Sub TextBoxTotal_TextChanged(sender As Object, e As EventArgs) Handles TextBoxTotal.TextChanged
        If TextBoxTotal.Text <> "" Then
            Call Hitung()
        End If
    End Sub


    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
        If TextBoxNumberPurchase.Text = "" Then
            MsgBox("Number Purchase Ticket wajib diisi!")
        Else
            Dim response = MsgBox("Konfirmasi telah melakukan pembayaran?", MsgBoxStyle.YesNo)
            If response = MsgBoxResult.Yes Then
                FileOpen(1, TextBoxNumberPurchase.Text + ".txt", OpenMode.Output)
                PrintLine(1, "Nama: " + TextBoxFullname.Text)
                PrintLine(1, "Total: " + TextBoxTotal.Text)
                FileClose(1)
                MsgBox("Terimakasih telah melakukan pembayaran!")
            End If
        End If
    End Sub

   
    Private Sub ButtonReset_Click(sender As Object, e As EventArgs) Handles ButtonReset.Click
        TextBoxNumberPurchase.Text = ""
        TextBoxFullname.Text = ""
        TextBoxPrice.Text = ""
        TextBoxQuantity.Text = ""
        TextBoxStudentPrice.Text = ""
        TextBoxStudentQuantity.Text = ""
        ComboBoxBand.Text = ""
        ComboBoxDate.Text = ""
        ComboBoxMonth.Text = ""
        ComboBoxYear.Text = ""
        NumericUpDownAdult.Text = ""
        NumericUpDownStudent.Text = ""
        TextBoxTotal.Text = ""
    End Sub

    Private Sub ButtonExit_Click(sender As Object, e As EventArgs) Handles ButtonExit.Click
        Me.Close()
    End Sub

    Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
        ListBox1.Items.Add(TextBoxNumberPurchase.Text)
        ListBox1.Items.Add(TextBoxFullname.Text)
        ListBox1.Items.Add(TextBoxCreditCard.Text)
      
    End Sub

    'Jika Hitung diCall
    Private Sub Hitung()
        Dim objHitung As New ClassInputPemesanan
        objHitung.banyak = TextBoxQuantity.Text
        objHitung.banyakstudent = TextBoxStudentQuantity.Text
        objHitung.harga = TextBoxPrice.Text
        objHitung.hargastudent = TextBoxStudentPrice.Text
        TextBoxTotal.Text = objHitung.hitung(objHitung.harga, objHitung.hargastudent, objHitung.banyak, objHitung.banyakstudent)
    End Sub

End Class


FORM 2


Public Class Form2


    Private Sub RadioButtonBM_CheckedChanged(sender As Object, e As EventArgs) Handles RadioButtonBM.CheckedChanged
        If RadioButtonBM.Checked = True Then
            PictureBox1.Image = Image.FromFile("aa.png")
            TextBoxBandDesc.Text = "Sarasvati Movie Festival 2015 is an annual movie and arts festival held at Lapangan Tennis Indoor Senayan,Jakarta, Indonesia."
        End If
    End Sub

    Private Sub RadioButton1975_CheckedChanged(sender As Object, e As EventArgs) Handles RadioButton1975.CheckedChanged
        If RadioButton1975.Checked = True Then
            Dim objBand As ClassBand
            objBand = New ClassBand
            objBand.Name = "Pitch Perfects 2"
            objBand.Desc = "The Bella's are back, and they are better than ever. After being humiliated infront of none other than the President of the United States of America, the Bella's are taken out of the Aca-Circuit. In order to clear their name, and regain their status, the Bella's take on a seemingly impossible task: winning an International competition no American team has ever won. In order to accomplish this monumental task, they need to strengthen the bonds of friendship and sisterhood, and blow away the competition with their amazing aca-magic! With all new friends and old rivals tagging along for the trip, the Bella's can hopefully accomplish their dreams."
            objBand.Image = Image.FromFile("a.jpg")

            PictureBox1.Image = objBand.Image
            TextBoxBandDesc.Text = objBand.Desc
        End If
    End Sub

    Private Sub RadioButtonLG_CheckedChanged(sender As Object, e As EventArgs) Handles RadioButtonLG.CheckedChanged
        If RadioButtonLG.Checked = True Then
            Dim objBand As ClassBand
            objBand = New ClassBand
            objBand.Name = "Avengers"
            objBand.Desc = "Marvel Studios presents 'Avengers: Age of Ultron' the epic follow-up to the biggest Super Hero movie of all time. When Tony Stark tries to jumpstart a dormant peacekeeping program, things go awry and Earth’s Mightiest Heroes, including Iron Man, Captain America, Thor, The Incredible Hulk, Black Widow and Hawkeye, are put to the ultimate test as the fate of the planet hangs in the balance. As the villainous Ultron emerges, it is up to The Avengers to stop him from enacting his terrible plans, and soon uneasy alliances and unexpected action pave the way for an epic and unique global adventure. Marvel’s Avengers: Age of Ultron stars Robert Downey Jr., who returns as Iron Man, along with Chris Evans as Captain America, Chris Hemsworth as Thor and Mark Ruffalo as The Hulk. Together with Scarlett Johansson as Black Widow and Jeremy Renner as Hawkeye, and with the additional support of Samuel L. Jackson as Nick Fury and Cobie Smulders as Agent Maria Hill, the team must reassemble to defeat James Spader as Ultron, a terrifying technological villain hell-bent on human extinction. Along the way, they confront two mysterious and powerful newcomers, Wanda Maximoff, played by Elizabeth Olsen, and Pietro Maximoff, played by Aaron Taylor-Johnson, and meet an old friend in a new form when Paul Bettany becomes Vision. Written and directed by Joss Whedon and produced by Kevin Feige, Marvel’s Avengers: Age of Ultron is based on the ever-popular Marvel comic book series The Avengers' first published in 1963. Louis D’Esposito, Alan Fine, Victoria Alonso, Jeremy Latcham, Patricia Whitcher, Stan Lee and Jon Favreau serve as executive producers. Get set for an action-packed thrill ride when The Avengers return in Marvel’s Avengers: Age of Ultron on May 1, 2015."
            objBand.Image = Image.FromFile("b.jpg")

            PictureBox1.Image = objBand.Image
            TextBoxBandDesc.Text = objBand.Desc
        End If
    End Sub

    Private Sub RadioButtonWA_CheckedChanged(sender As Object, e As EventArgs) Handles RadioButtonWA.CheckedChanged
        If RadioButtonWA.Checked = True Then
            Dim objBand As ClassBand
            objBand = New ClassBand
            objBand.Name = "Cobain : Montage of Heck"
            objBand.Desc = "The authorized documentary on late Guitar/lead singer Kurt Cobain from his early days in Aberdeen Washington to his success and downfall with Grunge band Nirvana."
            objBand.Image = Image.FromFile("c.jpg")

            PictureBox1.Image = objBand.Image
            TextBoxBandDesc.Text = objBand.Desc
        End If
    End Sub

    Private Sub RadioButtonSR_CheckedChanged(sender As Object, e As EventArgs) Handles RadioButtonSR.CheckedChanged
        If RadioButtonSR.Checked = True Then
            Dim objBand As ClassBand
            objBand = New ClassBand
            objBand.Name = "Tommorowland"
            objBand.Desc = "From Disney comes two-time Oscar winner Brad Bird’s riveting, mystery adventure Tomorrowland,starring Academy Award winner George Clooney. Bound by a shared destiny, former boy-genius Frank (Clooney), jaded by disillusionment, and Casey (Britt Robertson), a bright, optimistic teen bursting with scientific curiosity, embark on a danger-filled mission to unearth the secrets of an enigmatic place somewhere in time and space known only as Tomorrowland What they must do there changes the world—and them—forever."
            objBand.Image = Image.FromFile("d.jpg")

            PictureBox1.Image = objBand.Image
            TextBoxBandDesc.Text = objBand.Desc

        End If
    End Sub

    Private Sub Form2_Load(sender As Object, e As EventArgs) Handles MyBase.Load
        PictureBox1.Image = Image.FromFile("aa.png")
    End Sub
End Class


CLASS PEMESANAN

Public Class ClassInputPemesanan
    Private iharga, ihargastudent, ibanyak, ibanyakstudent, ihargatotal

    Public Property harga As Integer
        Get
            harga = iharga
        End Get
        Set(value As Integer)
            iharga = value
        End Set
    End Property

    Public Property hargastudent As Integer
        Get
            hargastudent = ihargastudent
        End Get
        Set(value As Integer)
            ihargastudent = value
        End Set
    End Property

    Public Property banyak As Integer
        Get
            banyak = ibanyak
        End Get
        Set(value As Integer)
            ibanyak = value
        End Set
    End Property

    Public Property banyakstudent As Integer
        Get
            banyakstudent = ibanyakstudent
        End Get
        Set(value As Integer)
            ibanyakstudent = value
        End Set
    End Property


    Function hitung(harga, hargastudent, banyak, banyakstudent)
        hitung = (banyak * harga) + (banyakstudent * hargastudent)
    End Function


End Class

Class dari movie untuk menggambarkan gambar


Public Class ClassBand
    Private _name As String
    Private _desc As String
    Private _image As Image

    Public Property Name() As String
        Get
            Name = _name
        End Get
        Set(value As String)
            _name = value
        End Set
    End Property

    Public Property Desc() As String
        Get
            Desc = _desc
        End Get
        Set(value As String)
            _desc = value
        End Set
    End Property

    Public Property Image() As Image
        Get
            Image = _image
        End Get
        Set(value As Image)
            _image = value
        End Set
    End Property

End Class

FORM HOME


Public Class FormHome


    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
        Form2.Show()
    End Sub

    Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
        Form1.Show()
    End Sub

    Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click
        Me.Close()
    End Sub

    Private Sub FormHome_Load(sender As Object, e As EventArgs) Handles MyBase.Load
        PictureBox1.Image = Image.FromFile("saras.jpg")
    End Sub

   
End Class