Please help me with the following Visual Basic application: The university has t
ID: 3774671 • Letter: P
Question
Please help me with the following Visual Basic application:
The university has the following Dormitories:
Siegel Hall $1,500 per semester
Papp Hall $1,500 per semester
Coles Hall $1,200 per semester
University Hall $1,800 per semester
The university also offers the following meal plans:
7 meals per week $560 per semester
14 meals per week $1,095 per semester
Unlimited meals $1,800 per semester
Create an application with three forms. The startup holds the totals charges and the name of the student.
You will have a dormitories form and and a meal plan form. Implement a menu that allows the user to open the dorms and the meal forms. When the user selects a dormitory and a meal, the application should show the total charges and selections for the semester on the startup form. Use a listbox to hold the items selected and labels to hold the totals. On the other forms use a listbox to select the dorms and meal plans.
Design guidelines: In addition to what is stated use a menu, add color to the form and a title, cancel and accept buttons, set tab order.
Explanation / Answer
Hello,
Please see below the code for the forms as requested,
Here it is for form 2
Public Class frmMealPlan
Private Sub frmMealPlan_FormClosing(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosingEventArg... Handles Me.FormClosing
End Sub
Private Sub frmMealPlan_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
End Sub
Private Sub btnCancel_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCancel.Click
'Closes the form
Me.Close()
End Sub
Public Sub btnEnter_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnEnter.Click
Dim Meal7 As Integer = 560
Dim Meal14 As Integer = 1095
Dim Unlimitted As Integer = 1500
Dim Results As Integer
If ListBox1.SelectedIndex = -1 Then
MessageBox.Show("Select a Meal Plan", "Error")
End If
If ListBox1.SelectedIndex = 0 Then
Results = Meal7
ElseIf ListBox1.SelectedIndex = 1 Then
Results = Meal14
ElseIf ListBox1.SelectedIndex = 2 Then
Results = Unlimitted
End If
End Sub
End Class
Public Class frmMain
Private Sub btnExit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnExit.Click
Me.Close()
End Sub
Private Sub frmMain_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
End Sub
Public Sub btnCalculate_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCalculate.Click
Dim AllenHall As Integer = 1500
Dim PikeHall As Integer = 1600
Dim FathingHall As Integer = 1200
Dim UniversitySuites As Integer = 180
If ListBox1.SelectedIndex = -1 Then
MessageBox.Show("Select a Meal Plan!")
End If
If ListBox1.SelectedIndex = 0 Then
lblDormCost.Text = AllenHall.ToString
ElseIf ListBox1.SelectedIndex = 1 Then
lblDormCost.Text = PikeHall.ToString
ElseIf ListBox1.SelectedIndex = 2 Then
lblDormCost.Text = FathingHall.ToString
ElseIf ListBox1.SelectedIndex = 3 Then
lblDormCost.Text = UniversitySuites.ToString
End If
End Sub
Private Sub btnSelectMeal_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSelectMeal.Click
Dim frmMealPlan As New frmMealPlan
frmMealPlan.Show()
End Sub
Business Logic as required :