Lab Quiz 9
Lab Quiz 9
ATTENTION:
• Programs which contain compile/build errors will NOT be graded.
• For each question, write your name, ID number and the purpose of the question at the beginning of your
source code as a comment line.
• In all of the programs, use COMMENTS where necessary.
• Code blocks inside comments will NOT be graded.
• Create your solutions under the name “YourFullName_LQ9_sols”
Meal
- mealName: String
- type: String
+ Meal (String,String) RIS
+ toString(): String - chefs: ArrayList<Chef>
+ equals(Meal): boolean
necessary getters and setters + addChef(Chef):boolean
+ getAllChefsWithMeals():String
+ getAllChefs():String
+ checkChef(int):int
+ listType(String): String
Employee (5 pts)
• Write the data members, constructor and override toString() method.
4
Chef (15 pts)
• Write the data members, constructor and override toString() method.
• Write an addMeal method that gets a Meal object as a parameter and adds it to the ArrayList if that
meal doesn’t exist in the ArrayList.
• Write a getMealsOfChef method that returns the meals that chef can cook as a String.
• (5 pts) When user clicks “ADD CHEF & MEAL” button related frame will be shown.
• (3 pts) When user selects between “Add Chef” and “Add Meal” radio buttons only the 3 rd label will be
changed as seen in the above screen shots.
o (10 pts) When user clicks “ADD” button program should add the chef to the Arraylist if it doesn’t
exist in the ArrayList.
4
• If the user selects the Add Meal radiobutton:
o (10 pts) When user clicks “ADD” button program should add the meal to the Arraylist if it doesn’t
exist in the ArrayList. Also checks if that chef exists or not.
4
• (2 pts) When user clicks “CLEAR” button all textfields and messageLabel will be cleared and combobox should
return to default selection.
• (5 pts) When user clicks “DISPLAY” button from the first frame the following frame will be shown.
Bonus
• (5 pts) When user clicks “Display Chefs” button all chefs will be displayed in the text area.
4
• (5 pts) When user clicks “Display Meals” button all meals with the chefs will be displayed in the text area.
• (Bonus 5 pts) When user selects a meal type from combobox, meals with selected type will be displayed in
the text area.