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

***JAVA PROGRAMMING*** DORM AND MEAL PLAN CALCULATOR A UNIVERSITY HAS THE FOLLOW

ID: 3589014 • 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.

*STARTER FILE*

package chapter12;

//imports

/**

* Your name here

* Chapter 12

* Programming Challenge 3,

* Dorm and Meal Plan Calculator

*/

public class DormAndMealPlanCalc extends JFrame {

   // Array with dorm names

   // Array with meal plan descriptions

// Combo box to display dorms

  

   // Combo box to display meal plans

   // To calculate prices

  

   // To exit the application

// Panel for dorm combo box

   // Panel for meal combo box

   // Panel for the buttons

   /**

   * Constructor

   */

   public DormAndMealPlanCalc() {

       // Display a title.

      

       // Specify what happens when the close button is clicked.

      

       // Build the dorm panel.

      

       // Build the meal plan panel.

       // Build the button panel.

       // Add the panels to the content pane.

       // Pack and display the window.

   }

   /**

   * buildDormPanel method

   */

   private void buildDormPanel() {

       // Create a label prompting the user to select a dorm.

       // Create the dorm combo box.

       // Put the components in a panel.

   }

   /**

   * buildMealPanel method

   */

   private void buildMealPanel() {

       // Create a label prompting the user to select a meal plan.

       // Create the meal plan combo box.

       // Put the components in a panel.

   }

   /**

   * buildButtonPanel method

   */

   private void buildButtonPanel() {

       // Create a button to calculate the charges.

       // Add an action listener to the button.

       // Create a button to exit the application.

       // Add an action listener to the button.

       // Put the buttons in their own panel.

   }

  

   /**

   * CalcButtonListener is an action listener class for the calcbutton

   * component.

   */

//calc code here

  

   /**

   * ExitButtonListener is an action listener class for the exitButton

   * component.

   */

//exit code here

  

  

   /**

   * The main method creates an instance of the DormAndMealPlanCalc class.

   */

   public static void main(String[] args) {

       DormAndMealPlanCalc dmpc = new DormAndMealPlanCalc();

   }

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