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

SQIT1013 Individual

Rental Cost TABLE 1 gives the price schedule for Najib’s Equipment Rental. Full-day rentals cost one-and-a-half times and half-day rentals. Write a program that displays possible output in a list box when an appropriate button is clicked on and displays a bill in another list box based on the item number and time period chosen by a customer. The bill should include a RM 30 deposit. TABLE 1 Piece of Equipment Half-Day Full-Day 1.Rug cleaner RM 16 RM 24 2.Lawn mower RM 12 RM18 3.Paint sprayer RM

Uploaded by

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

SQIT1013 Individual

Rental Cost TABLE 1 gives the price schedule for Najib’s Equipment Rental. Full-day rentals cost one-and-a-half times and half-day rentals. Write a program that displays possible output in a list box when an appropriate button is clicked on and displays a bill in another list box based on the item number and time period chosen by a customer. The bill should include a RM 30 deposit. TABLE 1 Piece of Equipment Half-Day Full-Day 1.Rug cleaner RM 16 RM 24 2.Lawn mower RM 12 RM18 3.Paint sprayer RM

Uploaded by

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

SQIT1013

Individual Assignment (5%) – {DUE DATE: 11 NOVEMBER}


Rental Cost

TABLE 1 gives the price schedule for Najib’s Equipment Rental. Full-day rentals cost one-
and-a-half times and half-day rentals. Write a program that displays possible output in a list
box when an appropriate button is clicked on and displays a bill in another list box based on
the item number and time period chosen by a customer. The bill should include a RM 30
deposit.

TABLE 1

Piece of Equipment Half-Day Full-Day


1. Rug cleaner RM 16 RM 24
2. Lawn mower RM 12 RM18
3. Paint sprayer RM 20 RM 30
My code

Private Sub btnDisplayRates_Click(ByVal sender As Object, ByVal e As


EventArgs) Handles btnDisplayRates.Click

ListBox1.Items.Add("Price of Equipment" & vbTab & vbTab & "Half Day" &
vbTab & vbTab & "Full Day")

ListBox1.Items.Add("1. Rug Cleaner" & vbTab & vbTab & "RM16.00" & vbTab
& vbTab & "RM24.00")

ListBox1.Items.Add("2. Lawn Mower" & vbTab & vbTab & "RM12.00" & vbTab
& vbTab & "RM18.00")

ListBox1.Items.Add("3. Paint Sprayer" & vbTab & vbTab & "RM20.00" &
vbTab & vbTab & "RM30.00")

End Sub

Private Sub ListBox1_SelectedIndexChanged(ByVal sender As System.Object,


ByVal e As System.EventArgs) Handles ListBox1.SelectedIndexChanged

End Sub

Private Sub btnDisplayBill_Click(ByVal sender As Object, ByVal e As


EventArgs) Handles btnDisplayBill.Click

ListBox2.Items.Clear()

If (txtItem.Text = "1" Or txtItem.Text = "2" Or txtItem.Text = "3") And


(txtDuration.Text.ToUpper() = "H" Or txtDuration.Text.ToUpper() = "F") Then

Const deposit = 30

Dim item, duration As String

Dim itemsCost As Double

item = txtItem.Text

duration = txtDuration.Text.ToUpper()

Select Case item

Case "1"

item = "Rug Cleaner"

itemsCost = 16
Case "2"

item = "lawn Mower"

itemsCost = 12

Case "3"

item = "Paint Sprayer"

itemsCost = 20

End Select

If duration = "F" Then

itemsCost = itemsCost + (itemsCost * 0.5)

duration = "Full Day"

Else

duration = "Half Day"

End If

ListBox2.Items.Add("Receipt for your equipment rental")

ListBox2.Items.Add("")

ListBox2.Items.Add(item & ":" & itemsCost.ToString("C2") & " " &


duration)

ListBox2.Items.Add("Deposit: " & deposit.ToString("C2"))

ListBox2.Items.Add("")

ListBox2.Items.Add("Total: " & (itemsCost +


deposit).ToString("C2"))

Else

MessageBox.Show("Please correct your input", "Invalid input",


MessageBoxButtons.OK)

End If

End Sub

End Class
Display
Display for Rug cleaner

Half-day

Full-day
Display for Lawn mower

Half-day

Full-day
Display for Paint sprayer

Half-day

Full-day

You might also like