SlideShare a Scribd company logo
Assignment: Object Oriented Programming in Java 
Information 
 This assignment is to be done in pairs (groups of 2). 
 Total: 20 marks 
o Exercises a-d : 12 marks 
o Exercises e: 3 marks 
o Exercise f: 5 marks 
Case Description 
The Michelin is a restaurant situated in a small city called Winsum, located in the northern part of The Netherlands. The owner, Miss Lisanne, has enlisted your help, as a technology consultant, to develop a Java application for automating the customer ordering process. Miss Lisanne describes menus (dishes) in her restaurant as follows. 
All menus are identified by a name, e.g. “stamppot boerenkool”, the amount of calories of the dish, e.g. 564.65 kcal, the estimated cooking time in minutes, e.g. 45 min (only integer values), the price per person, e.g. 20.5, and the number of wine bottles included, e.g. 0.5. 
Based on this description, complete the assignment by following the exercises listed below. 
Exercise a 
 Create a Java class (in a Java Project in Eclipse) to represent a menu from the description Miss Lisanne. You can call your class Menu (or any other name that you prefer). Note that this class only serves as a “template” (you do not give values to the attributes yet, but simply define the attributes and the methods). 
 Hint: 
o Define the attributes of the class, their types (e.g. String) and visibility. 
o Add the constructor in the class 
o Define the getter and setter methods for each of the attributes 
o Pay attention to the Java naming conventions for classes and methods 
Exercise b 
 Add a method in your class to print the details of the menus in the format below: 
o Menu <name> contains <calories> calories, comes with <number of wine bottles> bottles and cost <price> 
o Note that <name>, <calories> , <number of wine bottles> and <price> correspond to the attributes of your class. 
 You are free to use any name for your method.
Exercise c 
 (In the same Java Project) Create another class containing the “main” method. 
 In this “main class”, create 5 objects of the class Menu, as defined in the table below. 
name 
amount of calories 
cooking time 
price per person 
number of wine bottles 
Stamppot boerenkool 
564.65 
45 
20.5 
0.5 
Metworst 
345 
12 
10.99 
0 
Hutspot 
560.4 
65 
30.9 
1 
Biefstuk 
780 
46 
50.34 
2 
Kibbeling 
450.4 
23 
20.78 
1 
Exercise d 
 In your “main class” create an array of length 5, and store the 5 objects (Exercise c) into the array. You can use any name for your array. 
 From the array, use a loop to 
o Print the details of all the objects using the method you defined in Exercise b. An example output: 
Exercise e 
 Use another loop to: 
o Print only the name and cooking time of all the dishes that take less than 30 minutes to cook. Hint: you may use the getter methods for the name and cooking time attributes, and then, print these values (name, cooking time). An example output is shown below. “Metworst” and “Kibbeling” correspond to the names, while 12 and 23 correspond to the cooking time. 
Menu Stamppot boerenkool contains 564.65 calories, comes with 0.5 bottles and cost 20.5 
Menu Metworst contains 345.0 calories, comes with 0.0 bottles and cost 10.99 
Menu Hutspot contains 560.4 calories, comes with 1.0 bottles and cost 30.9 
Menu Biefstuk contains 780.0 calories, comes with 2.0 bottles and cost 50.34 
Menu Kibbeling contains 450.4 calories, comes with 1.0 bottles and cost 20.78 
Metworst cooks in 12 
Kibbeling cooks in 23
Exercise f 
 Use another loop to 
o Calculate and print the total price of all the objects (in the array). Example output: 
o Calculate the total price of all the objects. If the price is more than 65, give a discount of 10% and print the total price and the discounted price. Example output: 
Submission 
 Locate your 2 classes (Menu and “main class”). In your PC, these files will have extension “.java”. They will be in a folder that has the same name as your Java Project name in Eclipse. 
 Copy these 2 files to a new folder. The folder name should be the ids of the 2 group members separated by an underscore (“_”). For e.g. if the members have ids S1 and S2, then the folder name is “S1_S2”. 
 Zip the folder and submit it via Lol@, under Travaux  Java Assignment. (Only 1 of the team member needs to submit) 
 To evaluate your work, we will first look at the codes, and then run it (the “main class”) to see if the results are correct. 
The total price is: 133.51 
The total price is: 133.51 
The discounted price is: 120.15

More Related Content

Similar to A07

ECET 370 Success Begins/Newtonhelp.com
ECET 370 Success Begins/Newtonhelp.comECET 370 Success Begins/Newtonhelp.com
ECET 370 Success Begins/Newtonhelp.com
ledlang1
 
ECET 370 Inspiring Innovation--ecet370.com
ECET 370 Inspiring Innovation--ecet370.comECET 370 Inspiring Innovation--ecet370.com
ECET 370 Inspiring Innovation--ecet370.com
kopiko106
 
ECET 370 HELPS Redefined Education--ecet370helps.com
ECET 370 HELPS Redefined Education--ecet370helps.comECET 370 HELPS Redefined Education--ecet370helps.com
ECET 370 HELPS Redefined Education--ecet370helps.com
GVlaxmi7
 
ECET 370 Achievement Education -- www.ecet370.com
ECET 370 Achievement Education -- www.ecet370.comECET 370 Achievement Education -- www.ecet370.com
ECET 370 Achievement Education -- www.ecet370.com
shanaabe90
 
ECET 370 HELPS Education Counseling--ecet370helps.com
ECET 370 HELPS  Education Counseling--ecet370helps.comECET 370 HELPS  Education Counseling--ecet370helps.com
ECET 370 HELPS Education Counseling--ecet370helps.com
claric64
 
Page 8 of 83.Tutorial Get Started with Eclipse in the Compute.docx
Page 8 of 83.Tutorial Get Started with Eclipse in the Compute.docxPage 8 of 83.Tutorial Get Started with Eclipse in the Compute.docx
Page 8 of 83.Tutorial Get Started with Eclipse in the Compute.docx
alfred4lewis58146
 
These are the outputs which should match they are 4 of them -outp.pdf
These are the outputs which should match they are 4 of them -outp.pdfThese are the outputs which should match they are 4 of them -outp.pdf
These are the outputs which should match they are 4 of them -outp.pdf
udit652068
 
Devry ecet 370 week 3 ilab the stack and the queue ad ts new
Devry ecet 370 week 3 ilab the stack and the queue ad ts newDevry ecet 370 week 3 ilab the stack and the queue ad ts new
Devry ecet 370 week 3 ilab the stack and the queue ad ts new
nikig6806
 
Devry ecet 370 week 3 ilab the stack and the queue ad ts new
Devry ecet 370 week 3 ilab the stack and the queue ad ts newDevry ecet 370 week 3 ilab the stack and the queue ad ts new
Devry ecet 370 week 3 ilab the stack and the queue ad ts new
mybrands2
 
Exercise 7B PostlabInstructions· Below is a list of the resou
Exercise 7B PostlabInstructions· Below is a list of the resouExercise 7B PostlabInstructions· Below is a list of the resou
Exercise 7B PostlabInstructions· Below is a list of the resou
BetseyCalderon89
 
Devry ecet 370 week 3 ilab the stack and the queue ad ts new
Devry ecet 370 week 3 ilab the stack and the queue ad ts newDevry ecet 370 week 3 ilab the stack and the queue ad ts new
Devry ecet 370 week 3 ilab the stack and the queue ad ts new
mailemail
 
Devry ecet 370 week 3 ilab the stack and the queue ad ts new
Devry ecet 370 week 3 ilab the stack and the queue ad ts newDevry ecet 370 week 3 ilab the stack and the queue ad ts new
Devry ecet 370 week 3 ilab the stack and the queue ad ts new
olivergeorg
 
Devry ecet 370 week 3 ilab the stack and the queue ad ts new
Devry ecet 370 week 3 ilab the stack and the queue ad ts newDevry ecet 370 week 3 ilab the stack and the queue ad ts new
Devry ecet 370 week 3 ilab the stack and the queue ad ts new
uopassignment
 
Programming Primer EncapsulationVB
Programming Primer EncapsulationVBProgramming Primer EncapsulationVB
Programming Primer EncapsulationVB
sunmitraeducation
 
Unit 4 Programming Assignment In this assignment, you will.docx
Unit 4 Programming Assignment In this assignment, you will.docxUnit 4 Programming Assignment In this assignment, you will.docx
Unit 4 Programming Assignment In this assignment, you will.docx
lillie234567
 
Ruby object graph
Ruby object graphRuby object graph
Ruby object graph
Avilay Parekh
 
C++ to java
C++ to javaC++ to java
Key Changes To The 7.4 Gradebook
Key Changes To The 7.4 GradebookKey Changes To The 7.4 Gradebook
Key Changes To The 7.4 Gradebook
Melanie
 
ECET 370 Entire Course NEW
ECET 370 Entire Course NEWECET 370 Entire Course NEW
ECET 370 Entire Course NEW
shyamuopuop
 
Chapter 3
Chapter 3Chapter 3
Chapter 3
EasyStudy3
 

Similar to A07 (20)

ECET 370 Success Begins/Newtonhelp.com
ECET 370 Success Begins/Newtonhelp.comECET 370 Success Begins/Newtonhelp.com
ECET 370 Success Begins/Newtonhelp.com
 
ECET 370 Inspiring Innovation--ecet370.com
ECET 370 Inspiring Innovation--ecet370.comECET 370 Inspiring Innovation--ecet370.com
ECET 370 Inspiring Innovation--ecet370.com
 
ECET 370 HELPS Redefined Education--ecet370helps.com
ECET 370 HELPS Redefined Education--ecet370helps.comECET 370 HELPS Redefined Education--ecet370helps.com
ECET 370 HELPS Redefined Education--ecet370helps.com
 
ECET 370 Achievement Education -- www.ecet370.com
ECET 370 Achievement Education -- www.ecet370.comECET 370 Achievement Education -- www.ecet370.com
ECET 370 Achievement Education -- www.ecet370.com
 
ECET 370 HELPS Education Counseling--ecet370helps.com
ECET 370 HELPS  Education Counseling--ecet370helps.comECET 370 HELPS  Education Counseling--ecet370helps.com
ECET 370 HELPS Education Counseling--ecet370helps.com
 
Page 8 of 83.Tutorial Get Started with Eclipse in the Compute.docx
Page 8 of 83.Tutorial Get Started with Eclipse in the Compute.docxPage 8 of 83.Tutorial Get Started with Eclipse in the Compute.docx
Page 8 of 83.Tutorial Get Started with Eclipse in the Compute.docx
 
These are the outputs which should match they are 4 of them -outp.pdf
These are the outputs which should match they are 4 of them -outp.pdfThese are the outputs which should match they are 4 of them -outp.pdf
These are the outputs which should match they are 4 of them -outp.pdf
 
Devry ecet 370 week 3 ilab the stack and the queue ad ts new
Devry ecet 370 week 3 ilab the stack and the queue ad ts newDevry ecet 370 week 3 ilab the stack and the queue ad ts new
Devry ecet 370 week 3 ilab the stack and the queue ad ts new
 
Devry ecet 370 week 3 ilab the stack and the queue ad ts new
Devry ecet 370 week 3 ilab the stack and the queue ad ts newDevry ecet 370 week 3 ilab the stack and the queue ad ts new
Devry ecet 370 week 3 ilab the stack and the queue ad ts new
 
Exercise 7B PostlabInstructions· Below is a list of the resou
Exercise 7B PostlabInstructions· Below is a list of the resouExercise 7B PostlabInstructions· Below is a list of the resou
Exercise 7B PostlabInstructions· Below is a list of the resou
 
Devry ecet 370 week 3 ilab the stack and the queue ad ts new
Devry ecet 370 week 3 ilab the stack and the queue ad ts newDevry ecet 370 week 3 ilab the stack and the queue ad ts new
Devry ecet 370 week 3 ilab the stack and the queue ad ts new
 
Devry ecet 370 week 3 ilab the stack and the queue ad ts new
Devry ecet 370 week 3 ilab the stack and the queue ad ts newDevry ecet 370 week 3 ilab the stack and the queue ad ts new
Devry ecet 370 week 3 ilab the stack and the queue ad ts new
 
Devry ecet 370 week 3 ilab the stack and the queue ad ts new
Devry ecet 370 week 3 ilab the stack and the queue ad ts newDevry ecet 370 week 3 ilab the stack and the queue ad ts new
Devry ecet 370 week 3 ilab the stack and the queue ad ts new
 
Programming Primer EncapsulationVB
Programming Primer EncapsulationVBProgramming Primer EncapsulationVB
Programming Primer EncapsulationVB
 
Unit 4 Programming Assignment In this assignment, you will.docx
Unit 4 Programming Assignment In this assignment, you will.docxUnit 4 Programming Assignment In this assignment, you will.docx
Unit 4 Programming Assignment In this assignment, you will.docx
 
Ruby object graph
Ruby object graphRuby object graph
Ruby object graph
 
C++ to java
C++ to javaC++ to java
C++ to java
 
Key Changes To The 7.4 Gradebook
Key Changes To The 7.4 GradebookKey Changes To The 7.4 Gradebook
Key Changes To The 7.4 Gradebook
 
ECET 370 Entire Course NEW
ECET 370 Entire Course NEWECET 370 Entire Course NEW
ECET 370 Entire Course NEW
 
Chapter 3
Chapter 3Chapter 3
Chapter 3
 

More from lksoo

Lo43
Lo43Lo43
Lo43
lksoo
 
Lo39
Lo39Lo39
Lo39
lksoo
 
Lo27
Lo27Lo27
Lo27
lksoo
 
Lo17
Lo17Lo17
Lo17
lksoo
 
Lo12
Lo12Lo12
Lo12
lksoo
 
T3
T3T3
T3
lksoo
 
T2
T2T2
T2
lksoo
 
T1
T1T1
T1
lksoo
 
T4
T4T4
T4
lksoo
 
P5
P5P5
P5
lksoo
 
P4
P4P4
P4
lksoo
 
P3
P3P3
P3
lksoo
 
P1
P1P1
P1
lksoo
 
P2
P2P2
P2
lksoo
 
L10
L10L10
L10
lksoo
 
L9
L9L9
L9
lksoo
 
L8
L8L8
L8
lksoo
 
L7
L7L7
L7
lksoo
 
L6
L6L6
L6
lksoo
 
L5
L5L5
L5
lksoo
 

More from lksoo (20)

Lo43
Lo43Lo43
Lo43
 
Lo39
Lo39Lo39
Lo39
 
Lo27
Lo27Lo27
Lo27
 
Lo17
Lo17Lo17
Lo17
 
Lo12
Lo12Lo12
Lo12
 
T3
T3T3
T3
 
T2
T2T2
T2
 
T1
T1T1
T1
 
T4
T4T4
T4
 
P5
P5P5
P5
 
P4
P4P4
P4
 
P3
P3P3
P3
 
P1
P1P1
P1
 
P2
P2P2
P2
 
L10
L10L10
L10
 
L9
L9L9
L9
 
L8
L8L8
L8
 
L7
L7L7
L7
 
L6
L6L6
L6
 
L5
L5L5
L5
 

Recently uploaded

Chapter wise All Notes of First year Basic Civil Engineering.pptx
Chapter wise All Notes of First year Basic Civil Engineering.pptxChapter wise All Notes of First year Basic Civil Engineering.pptx
Chapter wise All Notes of First year Basic Civil Engineering.pptx
Denish Jangid
 
How to Setup Warehouse & Location in Odoo 17 Inventory
How to Setup Warehouse & Location in Odoo 17 InventoryHow to Setup Warehouse & Location in Odoo 17 Inventory
How to Setup Warehouse & Location in Odoo 17 Inventory
Celine George
 
HYPERTENSION - SLIDE SHARE PRESENTATION.
HYPERTENSION - SLIDE SHARE PRESENTATION.HYPERTENSION - SLIDE SHARE PRESENTATION.
HYPERTENSION - SLIDE SHARE PRESENTATION.
deepaannamalai16
 
A Visual Guide to 1 Samuel | A Tale of Two Hearts
A Visual Guide to 1 Samuel | A Tale of Two HeartsA Visual Guide to 1 Samuel | A Tale of Two Hearts
A Visual Guide to 1 Samuel | A Tale of Two Hearts
Steve Thomason
 
writing about opinions about Australia the movie
writing about opinions about Australia the moviewriting about opinions about Australia the movie
writing about opinions about Australia the movie
Nicholas Montgomery
 
UGC NET Exam Paper 1- Unit 1:Teaching Aptitude
UGC NET Exam Paper 1- Unit 1:Teaching AptitudeUGC NET Exam Paper 1- Unit 1:Teaching Aptitude
UGC NET Exam Paper 1- Unit 1:Teaching Aptitude
S. Raj Kumar
 
Pengantar Penggunaan Flutter - Dart programming language1.pptx
Pengantar Penggunaan Flutter - Dart programming language1.pptxPengantar Penggunaan Flutter - Dart programming language1.pptx
Pengantar Penggunaan Flutter - Dart programming language1.pptx
Fajar Baskoro
 
Electric Fetus - Record Store Scavenger Hunt
Electric Fetus - Record Store Scavenger HuntElectric Fetus - Record Store Scavenger Hunt
Electric Fetus - Record Store Scavenger Hunt
RamseyBerglund
 
Nutrition Inc FY 2024, 4 - Hour Training
Nutrition Inc FY 2024, 4 - Hour TrainingNutrition Inc FY 2024, 4 - Hour Training
Nutrition Inc FY 2024, 4 - Hour Training
melliereed
 
BÀI TẬP DẠY THÊM TIẾNG ANH LỚP 7 CẢ NĂM FRIENDS PLUS SÁCH CHÂN TRỜI SÁNG TẠO ...
BÀI TẬP DẠY THÊM TIẾNG ANH LỚP 7 CẢ NĂM FRIENDS PLUS SÁCH CHÂN TRỜI SÁNG TẠO ...BÀI TẬP DẠY THÊM TIẾNG ANH LỚP 7 CẢ NĂM FRIENDS PLUS SÁCH CHÂN TRỜI SÁNG TẠO ...
BÀI TẬP DẠY THÊM TIẾNG ANH LỚP 7 CẢ NĂM FRIENDS PLUS SÁCH CHÂN TRỜI SÁNG TẠO ...
Nguyen Thanh Tu Collection
 
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
Nguyen Thanh Tu Collection
 
Leveraging Generative AI to Drive Nonprofit Innovation
Leveraging Generative AI to Drive Nonprofit InnovationLeveraging Generative AI to Drive Nonprofit Innovation
Leveraging Generative AI to Drive Nonprofit Innovation
TechSoup
 
SWOT analysis in the project Keeping the Memory @live.pptx
SWOT analysis in the project Keeping the Memory @live.pptxSWOT analysis in the project Keeping the Memory @live.pptx
SWOT analysis in the project Keeping the Memory @live.pptx
zuzanka
 
Film vocab for eal 3 students: Australia the movie
Film vocab for eal 3 students: Australia the movieFilm vocab for eal 3 students: Australia the movie
Film vocab for eal 3 students: Australia the movie
Nicholas Montgomery
 
Stack Memory Organization of 8086 Microprocessor
Stack Memory Organization of 8086 MicroprocessorStack Memory Organization of 8086 Microprocessor
Stack Memory Organization of 8086 Microprocessor
JomonJoseph58
 
Pharmaceutics Pharmaceuticals best of brub
Pharmaceutics Pharmaceuticals best of brubPharmaceutics Pharmaceuticals best of brub
Pharmaceutics Pharmaceuticals best of brub
danielkiash986
 
C1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptx
C1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptxC1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptx
C1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptx
mulvey2
 
Gender and Mental Health - Counselling and Family Therapy Applications and In...
Gender and Mental Health - Counselling and Family Therapy Applications and In...Gender and Mental Health - Counselling and Family Therapy Applications and In...
Gender and Mental Health - Counselling and Family Therapy Applications and In...
PsychoTech Services
 
BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...
BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...
BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...
Nguyen Thanh Tu Collection
 
Standardized tool for Intelligence test.
Standardized tool for Intelligence test.Standardized tool for Intelligence test.
Standardized tool for Intelligence test.
deepaannamalai16
 

Recently uploaded (20)

Chapter wise All Notes of First year Basic Civil Engineering.pptx
Chapter wise All Notes of First year Basic Civil Engineering.pptxChapter wise All Notes of First year Basic Civil Engineering.pptx
Chapter wise All Notes of First year Basic Civil Engineering.pptx
 
How to Setup Warehouse & Location in Odoo 17 Inventory
How to Setup Warehouse & Location in Odoo 17 InventoryHow to Setup Warehouse & Location in Odoo 17 Inventory
How to Setup Warehouse & Location in Odoo 17 Inventory
 
HYPERTENSION - SLIDE SHARE PRESENTATION.
HYPERTENSION - SLIDE SHARE PRESENTATION.HYPERTENSION - SLIDE SHARE PRESENTATION.
HYPERTENSION - SLIDE SHARE PRESENTATION.
 
A Visual Guide to 1 Samuel | A Tale of Two Hearts
A Visual Guide to 1 Samuel | A Tale of Two HeartsA Visual Guide to 1 Samuel | A Tale of Two Hearts
A Visual Guide to 1 Samuel | A Tale of Two Hearts
 
writing about opinions about Australia the movie
writing about opinions about Australia the moviewriting about opinions about Australia the movie
writing about opinions about Australia the movie
 
UGC NET Exam Paper 1- Unit 1:Teaching Aptitude
UGC NET Exam Paper 1- Unit 1:Teaching AptitudeUGC NET Exam Paper 1- Unit 1:Teaching Aptitude
UGC NET Exam Paper 1- Unit 1:Teaching Aptitude
 
Pengantar Penggunaan Flutter - Dart programming language1.pptx
Pengantar Penggunaan Flutter - Dart programming language1.pptxPengantar Penggunaan Flutter - Dart programming language1.pptx
Pengantar Penggunaan Flutter - Dart programming language1.pptx
 
Electric Fetus - Record Store Scavenger Hunt
Electric Fetus - Record Store Scavenger HuntElectric Fetus - Record Store Scavenger Hunt
Electric Fetus - Record Store Scavenger Hunt
 
Nutrition Inc FY 2024, 4 - Hour Training
Nutrition Inc FY 2024, 4 - Hour TrainingNutrition Inc FY 2024, 4 - Hour Training
Nutrition Inc FY 2024, 4 - Hour Training
 
BÀI TẬP DẠY THÊM TIẾNG ANH LỚP 7 CẢ NĂM FRIENDS PLUS SÁCH CHÂN TRỜI SÁNG TẠO ...
BÀI TẬP DẠY THÊM TIẾNG ANH LỚP 7 CẢ NĂM FRIENDS PLUS SÁCH CHÂN TRỜI SÁNG TẠO ...BÀI TẬP DẠY THÊM TIẾNG ANH LỚP 7 CẢ NĂM FRIENDS PLUS SÁCH CHÂN TRỜI SÁNG TẠO ...
BÀI TẬP DẠY THÊM TIẾNG ANH LỚP 7 CẢ NĂM FRIENDS PLUS SÁCH CHÂN TRỜI SÁNG TẠO ...
 
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
 
Leveraging Generative AI to Drive Nonprofit Innovation
Leveraging Generative AI to Drive Nonprofit InnovationLeveraging Generative AI to Drive Nonprofit Innovation
Leveraging Generative AI to Drive Nonprofit Innovation
 
SWOT analysis in the project Keeping the Memory @live.pptx
SWOT analysis in the project Keeping the Memory @live.pptxSWOT analysis in the project Keeping the Memory @live.pptx
SWOT analysis in the project Keeping the Memory @live.pptx
 
Film vocab for eal 3 students: Australia the movie
Film vocab for eal 3 students: Australia the movieFilm vocab for eal 3 students: Australia the movie
Film vocab for eal 3 students: Australia the movie
 
Stack Memory Organization of 8086 Microprocessor
Stack Memory Organization of 8086 MicroprocessorStack Memory Organization of 8086 Microprocessor
Stack Memory Organization of 8086 Microprocessor
 
Pharmaceutics Pharmaceuticals best of brub
Pharmaceutics Pharmaceuticals best of brubPharmaceutics Pharmaceuticals best of brub
Pharmaceutics Pharmaceuticals best of brub
 
C1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptx
C1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptxC1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptx
C1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptx
 
Gender and Mental Health - Counselling and Family Therapy Applications and In...
Gender and Mental Health - Counselling and Family Therapy Applications and In...Gender and Mental Health - Counselling and Family Therapy Applications and In...
Gender and Mental Health - Counselling and Family Therapy Applications and In...
 
BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...
BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...
BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...
 
Standardized tool for Intelligence test.
Standardized tool for Intelligence test.Standardized tool for Intelligence test.
Standardized tool for Intelligence test.
 

A07

  • 1. Assignment: Object Oriented Programming in Java Information  This assignment is to be done in pairs (groups of 2).  Total: 20 marks o Exercises a-d : 12 marks o Exercises e: 3 marks o Exercise f: 5 marks Case Description The Michelin is a restaurant situated in a small city called Winsum, located in the northern part of The Netherlands. The owner, Miss Lisanne, has enlisted your help, as a technology consultant, to develop a Java application for automating the customer ordering process. Miss Lisanne describes menus (dishes) in her restaurant as follows. All menus are identified by a name, e.g. “stamppot boerenkool”, the amount of calories of the dish, e.g. 564.65 kcal, the estimated cooking time in minutes, e.g. 45 min (only integer values), the price per person, e.g. 20.5, and the number of wine bottles included, e.g. 0.5. Based on this description, complete the assignment by following the exercises listed below. Exercise a  Create a Java class (in a Java Project in Eclipse) to represent a menu from the description Miss Lisanne. You can call your class Menu (or any other name that you prefer). Note that this class only serves as a “template” (you do not give values to the attributes yet, but simply define the attributes and the methods).  Hint: o Define the attributes of the class, their types (e.g. String) and visibility. o Add the constructor in the class o Define the getter and setter methods for each of the attributes o Pay attention to the Java naming conventions for classes and methods Exercise b  Add a method in your class to print the details of the menus in the format below: o Menu <name> contains <calories> calories, comes with <number of wine bottles> bottles and cost <price> o Note that <name>, <calories> , <number of wine bottles> and <price> correspond to the attributes of your class.  You are free to use any name for your method.
  • 2. Exercise c  (In the same Java Project) Create another class containing the “main” method.  In this “main class”, create 5 objects of the class Menu, as defined in the table below. name amount of calories cooking time price per person number of wine bottles Stamppot boerenkool 564.65 45 20.5 0.5 Metworst 345 12 10.99 0 Hutspot 560.4 65 30.9 1 Biefstuk 780 46 50.34 2 Kibbeling 450.4 23 20.78 1 Exercise d  In your “main class” create an array of length 5, and store the 5 objects (Exercise c) into the array. You can use any name for your array.  From the array, use a loop to o Print the details of all the objects using the method you defined in Exercise b. An example output: Exercise e  Use another loop to: o Print only the name and cooking time of all the dishes that take less than 30 minutes to cook. Hint: you may use the getter methods for the name and cooking time attributes, and then, print these values (name, cooking time). An example output is shown below. “Metworst” and “Kibbeling” correspond to the names, while 12 and 23 correspond to the cooking time. Menu Stamppot boerenkool contains 564.65 calories, comes with 0.5 bottles and cost 20.5 Menu Metworst contains 345.0 calories, comes with 0.0 bottles and cost 10.99 Menu Hutspot contains 560.4 calories, comes with 1.0 bottles and cost 30.9 Menu Biefstuk contains 780.0 calories, comes with 2.0 bottles and cost 50.34 Menu Kibbeling contains 450.4 calories, comes with 1.0 bottles and cost 20.78 Metworst cooks in 12 Kibbeling cooks in 23
  • 3. Exercise f  Use another loop to o Calculate and print the total price of all the objects (in the array). Example output: o Calculate the total price of all the objects. If the price is more than 65, give a discount of 10% and print the total price and the discounted price. Example output: Submission  Locate your 2 classes (Menu and “main class”). In your PC, these files will have extension “.java”. They will be in a folder that has the same name as your Java Project name in Eclipse.  Copy these 2 files to a new folder. The folder name should be the ids of the 2 group members separated by an underscore (“_”). For e.g. if the members have ids S1 and S2, then the folder name is “S1_S2”.  Zip the folder and submit it via Lol@, under Travaux  Java Assignment. (Only 1 of the team member needs to submit)  To evaluate your work, we will first look at the codes, and then run it (the “main class”) to see if the results are correct. The total price is: 133.51 The total price is: 133.51 The discounted price is: 120.15