Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Design and code a project to calculate the amount due for rentals. Movies may be

ID: 441403 • Letter: D

Question

Design and code a project to calculate the amount due for rentals. Movies may be in VHS (videotape) format or DVD format. Videotapes rent for $1.80 each and DVDs rent for $2.50. New releases are $3 for DVD and $2 for VHS. On the form include a text box to input the movie title and radio buttons to indicate whether the movie is in DVD or VHS format. Use one check box to indicate whether the person is a member; members receive a 10 percent discount. Another check box indicates a new release. Use buttons for "Calculate", "Clear for Next Item", "Order Complete", "Summary", "Print", and "Exit". The "Calculate" button should display the item amount and add to the subtotal. The "Clear for Next Item" button clears the check box for new releases, the movie title, and the radio buttons; the member check box cannot be changed until the current order is complete. Include validation to check for missing data. If the user clicks on the "Calculate" button without first entering the movie title and selecting the movie format, display a message box. For the "Order Complete" button, first confirm the operation with the user and clear the controls on the form for a new customer. The

Explanation / Answer

The following is the code for your project.

Public Class Form1


Const VidPrice As Decimal = 1.8
Public numberofcustomers As Integer
Public totalamt As Decimal

Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
Me.Close()

End Sub

Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
PrintForm1.PrintAction = Printing.PrintAction.PrintToPreview
PrintForm1.Print()

End Sub

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

NumberOfVidsTextBox.Clear()
RentalTextBox.Clear()
DiscountTextBox.Clear()
AmountTextBox.Clear()
With MemberTextBox
.Clear()
.Focus()

End With

End Sub

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
'calculate and display the rental amount

'declaring variable
Dim rental As Decimal
Dim Amount As Decimal
Dim numberofVids As Decimal
Dim Discount As Decimal = 0.1

'start the if statement to make sure a member number is entered.
'(usernumber must be at least 4 digits.)
If MemberTextBox.TextLength > 3 Then

'start the try statement to catch no videos rented error.
Try
'calculate the rental amount, the discount and the amount due
numberofVids = Decimal.Parse(NumberOfVidsTextBox.Text)
rental = numberofVids * VidPrice
Discount = rental * Discount
Amount = rental - Discount

'calculate totals for all customers
numberofcustomers = numberofcustomers + 1
totalamt = Amount + totalamt

'display the results
NumOfCustServTextBox.Text = numberofcustomers
RentalTextBox.Text = rental.ToString("C")
DiscountTextBox.Text = Discount.ToString("C")
AmountTextBox.Text = Amount.ToString("C")
TotalRentIncomeTextBox.Text = totalamt.ToString("C")

'end of try, if was error show the message
Catch ex As FormatException
MessageBox.Show("Error; No videos rented", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
End Try

'end of try, if was error show the message
Else
MessageBox.Show("Error; no member number entered, make sure you entered 4 digits", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
End If
End Sub
End Class

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote