For the following prompt. I used 2 different codes but when start the program nothing shows up on the form. What am I doing wrong? Public Class frmMain Private mdlSample As Object Private Sub frmMain_Load(sender As Object, e As EventArgs) Handles MyBase.Load 'Display the Dormitory price in the list box ListBox1.Items.Add("Allen Hall - 2,500.00 ") ListBox1.Items.Add("Pike Hall - 2,200.00") ListBox1.Items.Add("Farthing Hall - 2,100.00") ListBox1.Items.Add("UniversitySuites - 2,800.00") End Sub Private Sub btnAddDormitory_Click(sender As Object, e As EventArgs) Handles btnAddDormitory.Click ' if user don't choose any price in list box Select Case ListBox1.SelectedIndex Case -1 MessageBox.Show("Select A Dormitory Please!") End Select 'Determine the value in Module and display the value of price to lblDormitory Select Case ListBox1.SelectedIndex Case 0 lblDormitory.Text = mdlSample.Allen_Hall.ToString("c2") Case 1 lblDormitory.Text = mdlSample.Pike_Hall.ToString("c2") Case 2 lblDormitory.Text = mdlSample.Farthing_Hall.ToString("c2") Case 3 lblDormitory.Text = mdlSample.UniversitySuites.ToString("c2") End Select End Sub Private Sub btnViewMP_Click(sender As Object, e As EventArgs) Handles btnViewMeal.Click 'Display the second form (Meal Plan) Me.Hide() frmMeal.Show() End Sub Private Sub btnClear_Click(sender As Object, e As EventArgs) Handles btnClear.Click 'Clear all the label except the list box lblDormitory.Text = String.Empty lblMealPlan.Text = String.Empty lblTotalCost.Text = String.Empty End Sub Private Sub btnExit_Click(sender As Object, e As EventArgs) Handles btnExit.Click ' Exit Program Application.Exit() End Sub End Class Module mdlSample 'Public constants for Dormitory prices and weedkly meal plan prices Public Const Allen_Hall As Decimal = 2500D Public Const Pike_Hall As Decimal = 2200D Public Const Farthing_Hall As Decimal = 2100D Public Const UniversitySuites As Decimal = 2800D Public Const Meal_Plan_7 As Decimal = 1560D Public Const Meal_Plan_14 As Decimal = 2095D Public Const Meal_Plan_Unilimited As Decimal = 2500D End Module Public Class frmMeal Private mdlSample As Object Private Sub btnAdd_MP_Click(sender As Object, e As EventArgs) Handles btnAddMealPlan.Click 'Declare the variable Dim MealPlans As Integer ' if user doesn't choose any Meal Plan then display message box Select Case lstMealPlans.SelectedIndex Case -1 MessageBox.Show("Select A Meal Plan Please!") End Select ' Determine the value in Module and display the value of price to lblMeal_Plan in form Main Select Case lstMealPlans.SelectedIndex Case 0 frmMain.lblMealPlan.Text = mdlSample.Meal_Plan_7.ToString("c2") MealPlans = NewMethod() Case 1 frmMain.lblMealPlan.Text = mdlSample.Meal_Plan_14.ToString("c2") MealPlans = MealPlans = NewMethod() Case 2 frmMain.lblMealPlan.Text = mdlSample.Meal_Plan_Unilimited.ToString("c2") MealPlans = MealPlans = NewMethod() End Select 'Calculate the total of Dormitory and Meal Plan and display it to form Main frmMain.lblTotalCost.Text = (frmMain.lblDormitory.Text + MealPlans).ToString("c2") 'Display to the form Main (frmMain) Me.Hide() Form1.Show() End Sub Private Function NewMethod() As Integer Return mdlSample.Meal_Plan_7.Integer("c2") End Function Private Sub frmMealPlans_Load(sender As Object, e As EventArgs) Handles MyBase.Load 'Display the Weedkly Meal Plan price in the list box lstMealPlans.Items.Add("7 Meals - 1,560.00 ") lstMealPlans.Items.Add("14 Meals - 2,095.00") lstMealPlans.Items.Add("Unlimited Meals - 2,500.00") End Sub Private Sub btncClose_Click(sender As Object, e As EventArgs) Handles btnClose.Click ' Close program Me.Close() End Sub End Class
For the following prompt. I used 2 different codes but when start the program nothing shows up on the form. What am I doing wrong? Public Class frmMain Private mdlSample As Object Private Sub frmMain_Load(sender As Object, e As EventArgs) Handles MyBase.Load 'Display the Dormitory price in the list box ListBox1.Items.Add("Allen Hall - 2,500.00 ") ListBox1.Items.Add("Pike Hall - 2,200.00") ListBox1.Items.Add("Farthing Hall - 2,100.00") ListBox1.Items.Add("UniversitySuites - 2,800.00") End Sub Private Sub btnAddDormitory_Click(sender As Object, e As EventArgs) Handles btnAddDormitory.Click ' if user don't choose any price in list box Select Case ListBox1.SelectedIndex Case -1 MessageBox.Show("Select A Dormitory Please!") End Select 'Determine the value in Module and display the value of price to lblDormitory Select Case ListBox1.SelectedIndex Case 0 lblDormitory.Text = mdlSample.Allen_Hall.ToString("c2") Case 1 lblDormitory.Text = mdlSample.Pike_Hall.ToString("c2") Case 2 lblDormitory.Text = mdlSample.Farthing_Hall.ToString("c2") Case 3 lblDormitory.Text = mdlSample.UniversitySuites.ToString("c2") End Select End Sub Private Sub btnViewMP_Click(sender As Object, e As EventArgs) Handles btnViewMeal.Click 'Display the second form (Meal Plan) Me.Hide() frmMeal.Show() End Sub Private Sub btnClear_Click(sender As Object, e As EventArgs) Handles btnClear.Click 'Clear all the label except the list box lblDormitory.Text = String.Empty lblMealPlan.Text = String.Empty lblTotalCost.Text = String.Empty End Sub Private Sub btnExit_Click(sender As Object, e As EventArgs) Handles btnExit.Click ' Exit Program Application.Exit() End Sub End Class Module mdlSample 'Public constants for Dormitory prices and weedkly meal plan prices Public Const Allen_Hall As Decimal = 2500D Public Const Pike_Hall As Decimal = 2200D Public Const Farthing_Hall As Decimal = 2100D Public Const UniversitySuites As Decimal = 2800D Public Const Meal_Plan_7 As Decimal = 1560D Public Const Meal_Plan_14 As Decimal = 2095D Public Const Meal_Plan_Unilimited As Decimal = 2500D End Module Public Class frmMeal Private mdlSample As Object Private Sub btnAdd_MP_Click(sender As Object, e As EventArgs) Handles btnAddMealPlan.Click 'Declare the variable Dim MealPlans As Integer ' if user doesn't choose any Meal Plan then display message box Select Case lstMealPlans.SelectedIndex Case -1 MessageBox.Show("Select A Meal Plan Please!") End Select ' Determine the value in Module and display the value of price to lblMeal_Plan in form Main Select Case lstMealPlans.SelectedIndex Case 0 frmMain.lblMealPlan.Text = mdlSample.Meal_Plan_7.ToString("c2") MealPlans = NewMethod() Case 1 frmMain.lblMealPlan.Text = mdlSample.Meal_Plan_14.ToString("c2") MealPlans = MealPlans = NewMethod() Case 2 frmMain.lblMealPlan.Text = mdlSample.Meal_Plan_Unilimited.ToString("c2") MealPlans = MealPlans = NewMethod() End Select 'Calculate the total of Dormitory and Meal Plan and display it to form Main frmMain.lblTotalCost.Text = (frmMain.lblDormitory.Text + MealPlans).ToString("c2") 'Display to the form Main (frmMain) Me.Hide() Form1.Show() End Sub Private Function NewMethod() As Integer Return mdlSample.Meal_Plan_7.Integer("c2") End Function Private Sub frmMealPlans_Load(sender As Object, e As EventArgs) Handles MyBase.Load 'Display the Weedkly Meal Plan price in the list box lstMealPlans.Items.Add("7 Meals - 1,560.00 ") lstMealPlans.Items.Add("14 Meals - 2,095.00") lstMealPlans.Items.Add("Unlimited Meals - 2,500.00") End Sub Private Sub btncClose_Click(sender As Object, e As EventArgs) Handles btnClose.Click ' Close program Me.Close() End Sub End Class
Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
Related questions
Question
100%
For the following prompt. I used 2 different codes but when start the program nothing shows up on the form. What am I doing wrong?
Public Class frmMain
Private mdlSample As Object
Private Sub frmMain_Load(sender As Object, e As EventArgs) Handles MyBase.Load
'Display the Dormitory price in the list box
ListBox1.Items.Add("Allen Hall - 2,500.00 ")
ListBox1.Items.Add("Pike Hall - 2,200.00")
ListBox1.Items.Add("Farthing Hall - 2,100.00")
ListBox1.Items.Add("UniversitySuites - 2,800.00")
End Sub
Private Sub btnAddDormitory_Click(sender As Object, e As EventArgs) Handles btnAddDormitory.Click
' if user don't choose any price in list box
Select Case ListBox1.SelectedIndex
Case -1
MessageBox.Show("Select A Dormitory Please!")
End Select
'Determine the value in Module and display the value of price to lblDormitory
Select Case ListBox1.SelectedIndex
Case 0
lblDormitory.Text = mdlSample.Allen_Hall.ToString("c2")
Case 1
lblDormitory.Text = mdlSample.Pike_Hall.ToString("c2")
Case 2
lblDormitory.Text = mdlSample.Farthing_Hall.ToString("c2")
Case 3
lblDormitory.Text = mdlSample.UniversitySuites.ToString("c2")
End Select
End Sub
Private Sub btnViewMP_Click(sender As Object, e As EventArgs) Handles btnViewMeal.Click
'Display the second form (Meal Plan)
Me.Hide()
frmMeal.Show()
End Sub
Private Sub btnClear_Click(sender As Object, e As EventArgs) Handles btnClear.Click
'Clear all the label except the list box
lblDormitory.Text = String.Empty
lblMealPlan.Text = String.Empty
lblTotalCost.Text = String.Empty
End Sub
Private Sub btnExit_Click(sender As Object, e As EventArgs) Handles btnExit.Click
' Exit Program
Application.Exit()
End Sub
End Class
Module mdlSample
'Public constants for Dormitory prices and weedkly meal plan prices
Public Const Allen_Hall As Decimal = 2500D
Public Const Pike_Hall As Decimal = 2200D
Public Const Farthing_Hall As Decimal = 2100D
Public Const UniversitySuites As Decimal = 2800D
Public Const Meal_Plan_7 As Decimal = 1560D
Public Const Meal_Plan_14 As Decimal = 2095D
Public Const Meal_Plan_Unilimited As Decimal = 2500D
End Module
Public Class frmMeal
Private mdlSample As Object
Private Sub btnAdd_MP_Click(sender As Object, e As EventArgs) Handles btnAddMealPlan.Click
'Declare the variable
Dim MealPlans As Integer
' if user doesn't choose any Meal Plan then display message box
Select Case lstMealPlans.SelectedIndex
Case -1
MessageBox.Show("Select A Meal Plan Please!")
End Select
' Determine the value in Module and display the value of price to lblMeal_Plan in form Main
Select Case lstMealPlans.SelectedIndex
Case 0
frmMain.lblMealPlan.Text = mdlSample.Meal_Plan_7.ToString("c2")
MealPlans = NewMethod()
Case 1
frmMain.lblMealPlan.Text = mdlSample.Meal_Plan_14.ToString("c2")
MealPlans = MealPlans = NewMethod()
Case 2
frmMain.lblMealPlan.Text = mdlSample.Meal_Plan_Unilimited.ToString("c2")
MealPlans = MealPlans = NewMethod()
End Select
'Calculate the total of Dormitory and Meal Plan and display it to form Main
frmMain.lblTotalCost.Text = (frmMain.lblDormitory.Text + MealPlans).ToString("c2")
'Display to the form Main (frmMain)
Me.Hide()
Form1.Show()
End Sub
Private Function NewMethod() As Integer
Return mdlSample.Meal_Plan_7.Integer("c2")
End Function
Private Sub frmMealPlans_Load(sender As Object, e As EventArgs) Handles MyBase.Load
'Display the Weedkly Meal Plan price in the list box
lstMealPlans.Items.Add("7 Meals - 1,560.00 ")
lstMealPlans.Items.Add("14 Meals - 2,095.00")
lstMealPlans.Items.Add("Unlimited Meals - 2,500.00")
End Sub
Private Sub btncClose_Click(sender As Object, e As EventArgs) Handles btnClose.Click
' Close program
Me.Close()
End Sub
End Class

Transcribed Image Text:5. Dorm and Meal Plan Calculator ( Page 494)
Make sure to follow ALL instructions for this project
which specifically asks you to create a module and two
forms. The book shows you the forms in Figure 7-76
and Figure 7-77
5. Dorm and Meal Plan Calculator
Suppose a university has the following domstores, offered at these prices:
Alen Hall $2,500 per semester
Pike Hall $2,200 per semester
Farthing Hall 82,100 per semester
University Suites $2,800 per semester
Let us also assume the university also offers these meal plans
7 meals per week $1,500 per semester
14 meals per week $2,005 per semester
. Unlimited meals $2,000 per semester
Create an application with a module and two forms. The module holds defined constants for the various domitones and meal plans. The startup form holds the names of the dormitones, a set of buttons, a status bar, and labels that display semester
charges, as shown in Figure 7-76. A second form holds the list of meal plans, and selection buttons, shown in Figure 7-77. When the user selects a dormitory and meal plan, the application should show the total charges for the semester on
the startup form
Mote Use code statements in the Form Load event handler for each form to initialize the led bass with the names of the dominies ar meal plans, along with their prices. This med be done at runtime, to allow future changes in the values of price
constants to be displayed correctly in the list bo
Figure 7-76 Dorm and Meal Calculator-startup form
and Meal Plan Ca
Select a Dormitory
Allen Hall-2,500 00
Pike Hal-2200 00
Farthing Hall-2,100.00
University Suites-2,000.00
Add Dormitory
View Meal Plans
Select a Weekly Meal Plan
Charges for the Semester
Figure 7-77 Dorm and Meal Calculator-meal plans
7 Meals 1,560 00
14 Meals-2,095 00
Unlimited Meals-2.500.00
Dormitory $2,200.00
Meal Plan
Clear
$0,005 00
Tots $4,295 00
Ext
Add Meal Plan
Close
Expert Solution

This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
This is a popular solution!
Trending now
This is a popular solution!
Step by step
Solved in 3 steps

Follow-up Questions
Read through expert solutions to related follow-up questions below.
Follow-up Question
This code still has errors and the
Solution
Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Recommended textbooks for you

Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education

Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON

Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON

Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education

Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON

Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON

C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON

Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning

Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education