0% found this document useful (0 votes)
22 views8 pages

Ackon Mensah Joshua 4211220054

Uploaded by

David
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
22 views8 pages

Ackon Mensah Joshua 4211220054

Uploaded by

David
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 8

GHANA COMMUNICATION TECHNOLOGY

UNIVERSITY

FACULTY OF COMPUTING AND INFORMATION


SYSTEMS
PROGRAM: BSc. INFORMATION TECHNOLOGY
COURSE : VISUAL BASIC PROGRAMMING
LEVEL 300 MORNING SESSION
NAME: ACKON JOSHUA
MENSAH
INDEX NUMBER: 4211220054
ASSIGNMENT 4
Question 1
Public Class Form1

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


Me.Close()
End Sub

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


Static SubTotal As Double
Dim Price, SalesTaxDue, Total As Double
Double.TryParse(txtPrice.Text, Price)
SubTotal = SubTotal + Price
lstSales.Items.Add(FormatCurrency(Price))
SalesTaxDue = subTotal * 0.065
Total = SalesTaxDue + SubTotal
lblSubTotal.Text = FormatCurrency(SubTotal)
Me.SalesTaxDue.Text = FormatCurrency(SalesTaxDue)
lblTotal.Text = FormatCurrency(Total)
txtPrice.Clear()
txtPrice.Focus()

End Sub
End Class

Question 2

Public Class Form1


Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Static SubTotal As Double
Dim Price, SalesTaxDue, Total As Double
Dim Product As String
Double.TryParse(txtPrice.Text, Price)
Product = txtProduct.Text
SubTotal = SubTotal + Price
lstSales.Items.Add(Product & " || " & FormatCurrency(Price))
SalesTaxDue = SubTotal * 0.065
Total = SalesTaxDue + SubTotal
txtSubTotal.Text = FormatCurrency(SubTotal)
txtTotalTaxDue.Text = FormatCurrency(SalesTaxDue)
txtTotal.Text = FormatCurrency(Total)
txtPrice.Text = ""
txtProduct.Text = ""
txtPrice.Focus()

End Sub

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


Me.Close()
End Sub

Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load


lstSales.Items.Add("PRODUCT || PRICE")

End Sub
End Class

Question 3
Public Class Form1
Private Sub Label5_Click(sender As Object, e As EventArgs) Handles Label5.Click
End Sub
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
lstSales.Items.Add("PRODUCT QUANTITY UNIT PRICE TOTAL")
End Sub
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Static SubTotal As Double
Dim unitPrice, Price, SalesTaxDue, Total As Double
Dim quantity As Short
Dim Product As String
Product = txtProduct.Text
Double.TryParse(txtQuantity.Text, quantity)
Double.TryParse(txtUnitPrice.Text, unitPrice)
Price = quantity * unitPrice
SubTotal = SubTotal + Price
lstSales.Items.Add(Product & " " & quantity & " " & unitPrice & " " & FormatCurrency(Price))
SalesTaxDue = SubTotal * 0.065
Total = SalesTaxDue + SubTotal
txtSubTotal.Text = FormatCurrency(SubTotal)
txtTotalTaxDue.Text = FormatCurrency(SalesTaxDue)
txtTotal.Text = FormatCurrency(Total)
txtQuantity.Text = ""
txtUnitPrice.Text = ""
txtProduct.Text = ""
txtProduct.Focus()
End Sub
Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
Me.Close()
End Sub
End Class
Question 4

Public Class Form1


Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Dim monPesewa, pesewaside As Integer
Dim monCedis As Integer
monPesewa = CInt(txtpesewas.Text)
pesewaside = monPesewa Mod 100
monCedis = monPesewa \ 100
txtResults.Text = CStr(monCedis) & " Cedis, " &
CStr(pesewaside) & " Pesewas"
End Sub

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


Me.Close()
End Sub
End Class
Question 5

Public Class Form1


Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Dim amount As Integer
Dim Cedis As Integer
Dim pesewas As Integer
amount = CType(TextBox1.Text, Integer)
Cedis = amount / 100
pesewas = amount Mod 100
TextBox2.Text = "¢" & CType(Cedis, Integer) & "." & CType(pesewas, Integer)
End Sub

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


Me.Close()
End Sub

Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load


TextBox2.ReadOnly = True
End Sub
End Class
Question 6

Public Class Form1


Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Dim A As Integer
Dim X As Integer
Dim Z As Integer
Dim y As Double

A = CInt(txtvalueA.Text)
X = CInt(txtvalueX.Text)
Z = CInt(txtvalueZ.Text)

y = (Math.Sqrt(Math.Pow(X, 2) - 5 * Z) / 2 * A) + Math.Sin(X) - Math.Cos(Z) * (Math.Exp(A))


txtAns.Text = String.Format("{0:n3}", y)

End Sub
Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
Me.Close()
End Sub
End Class

You might also like