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:
***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 |
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
