***JAVA PROGRAMMING*** DORM AND MEAL PLAN CALCULATOR A UNIVERSITY HAS THE FOLLOW
ID: 3592304 • Letter: #
Question
***JAVA PROGRAMMING***
DORM AND MEAL PLAN CALCULATOR
A UNIVERSITY HAS THE FOLLOWING DORMITORIES:
ALLEN HALL: $1,500 PER SEMESTER
PIKE HALL: $1,600 PER SEMESTER
FARTHING HALL: $1,200 PER SEMESTER
UNIVERSITY SUITES: $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,500 PER SEMESTER
CREATE AN APPLICATION WITH TWO COMBO BOXES. ONE SHOULD HOLD THE NAMES OF THE DORMITIORIES AND THE OTHER SHOULD HOLD THE MEAL PLANS. THE USER SHOULD SELECT A DORMITORY AND A MEAL PLAN, AND THE APPLICATION SHOULD SHOW THE TOTAL CHARGES FOR THE SEMESTER.
Below is a reference table to verify your calculations
Meals/Hall
7 meals per week
14 meals per week
Unlimited meals per week
Allen Hall
$ 2,060.00
$ 2,595.00
$ 3,000.00
Pike Hall
$ 2,160.00
$ 2,695.00
$ 3,100.00
Farthing Hall
$ 1,760.00
$ 2,295.00
$ 2,700.00
University Suites
$ 2,360.00
$ 2,895.00
$ 3,300.00
Meals/Hall
7 meals per week
14 meals per week
Unlimited meals per week
Allen Hall
$ 2,060.00
$ 2,595.00
$ 3,000.00
Pike Hall
$ 2,160.00
$ 2,695.00
$ 3,100.00
Farthing Hall
$ 1,760.00
$ 2,295.00
$ 2,700.00
University Suites
$ 2,360.00
$ 2,895.00
$ 3,300.00
Explanation / Answer
It took me a few minutes to make sense of your concern. Your code needs some modification. In the second shape for the btn_Enter click occasion you pronounced a number variable called "Results". Things being what they are, why not do likewise for the primary frame and afterward include the two factors and dole out them to the name content? Here it is for the catch in the main frame:
Public Sub btnCalculate_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCalculate.Click
Diminish AllenHall As Integer = 1500
Diminish PikeHall As Integer = 1600
Diminish FathingHall As Integer = 1200
Diminish UniversitySuites As Integer = 180
Diminish dormResults As Integer
In the event that ListBox1.SelectedIndex = - 1 Then
MessageBox.Show("Select a Meal Plan!")
End If
In the event that ListBox1.SelectedIndex = 0 Then
lblDormCost.Text = AllenHall.ToString
dormResults = AllenHall
ElseIf ListBox1.SelectedIndex = 1 Then
lblDormCost.Text = PikeHall.ToString
dormResults = PikeHall
ElseIf ListBox1.SelectedIndex = 2 Then
lblDormCost.Text = FathingHall.ToString
dormResults = FarthingHall
ElseIf ListBox1.SelectedIndex = 3 Then
lblDormCost.Text = UniversitySuites.ToString
dormResults = UniversitySuites
End If
End Sub
And afterward for btnEnter in the second shape include the accompanying code as the last line:
Form1.lblDormCost.Text = Form1.dormResults + Results
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.