0% found this document useful (0 votes)
3 views5 pages

Lab Quiz 9

The document outlines the requirements for Quiz-9 in the CENG201 Object Oriented Programming I course at AYBU. Students must create classes based on a provided class diagram, implement specific methods, and submit their solutions in a zipped format. Only the first 40 submissions will be graded, and attendance at a lab session for code defense is mandatory for grading.

Uploaded by

Ömer
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views5 pages

Lab Quiz 9

The document outlines the requirements for Quiz-9 in the CENG201 Object Oriented Programming I course at AYBU. Students must create classes based on a provided class diagram, implement specific methods, and submit their solutions in a zipped format. Only the first 40 submissions will be graded, and attendance at a lab session for code defense is mandatory for grading.

Uploaded by

Ömer
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

AYBU Department of Computer Engineering

CENG201 – Object Oriented Programming I


FALL 2020 – 2021
QUIZ-9
17.01.2021

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”

• Send your project in a zipped format


ONLY FIRST 40 SUBMISSIONS WILL BE CALLED FOR THE QUIZ DEFENSE. IF YOU ARE IN THE LISTED 40, YOU
WILL BE ONLY GRADED DURING THE LAB SESSIONS AFTER YOUR DEFENSE.
IF YOU DON’T ATTEND TO LAB SESSION TO DEFEND YOUR CODE, YOU WILL NOT BE GRADED. MOREOVER,
YOU MUST PROVIDE A VALID EXCUSE. (A PENALTY MIGHT BE THE CONSEQUENCE OF INDECORUM)
IF YOU ALREADY HAVE FOUR GRADED QUIZZES BEFORE, DON’T ATTEMPT TO SUBMIT ANYMORE.

Question (100 points)


Create the classes in the Class diagram.

Employee <<Abstract>> Chef


# id: int - mastery: String
# name: String - canCook: ArrayList<Meal>
+ Employee (int,String) constructor with necessary parameters
+ toString(): String + toString(): String
+ addMeal(Meal): boolean
+ getMealsOfChef(): String
necessary getters and setters

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.

Meal (10 pts)


• Write the data members, constructor and override toString() method.
• Write an equals method that gets a Meal object as a parameter and checks if the name and type equals to the
object.

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.

RIS (25 pts + 15 pts Bonus)


• (3 pts) Write the data members.
• (5 pts) Write an addChef method that gets a Chef object as a parameter and adds it to ArrayList if it doesn’t
exist.
• (7 pts) Write a getAllChefsWithMeals method that returns all the meals with the related chefs as a String.
• (5 pts) Write a getAllChefs method that returns all the chefs as a String.
• (5 pts) Write a checkChef method that gets id as a parameter and returns the index of chef with the given id.
• (Bonus 15 pts) Write a listType method that gets a type as a parameter and returns all the meals with
the given type as a String.

Create a JFrame Form as shown below:

• (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.

• If the user selects the Add Chef radiobutton:

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.

You might also like