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

Viewers also liked

Prezentacja
PrezentacjaPrezentacja
Prezentacja
sp2zabki
 
755 Cordova Bay Rd - Open House Presentation
755 Cordova Bay Rd - Open House Presentation755 Cordova Bay Rd - Open House Presentation
755 Cordova Bay Rd - Open House Presentation
AragonProperties
 
Internet1
Internet1Internet1
Internet1
sp2zabki
 
Płock
PłockPłock
Płock
sp2zabki
 
Dbi
DbiDbi
Bezpieczeństwo w sieci prezentacja power point
Bezpieczeństwo w sieci prezentacja power pointBezpieczeństwo w sieci prezentacja power point
Bezpieczeństwo w sieci prezentacja power point
sp2zabki
 

Viewers also liked (6)

Prezentacja
PrezentacjaPrezentacja
Prezentacja
 
755 Cordova Bay Rd - Open House Presentation
755 Cordova Bay Rd - Open House Presentation755 Cordova Bay Rd - Open House Presentation
755 Cordova Bay Rd - Open House Presentation
 
Internet1
Internet1Internet1
Internet1
 
Płock
PłockPłock
Płock
 
Dbi
DbiDbi
Dbi
 
Bezpieczeństwo w sieci prezentacja power point
Bezpieczeństwo w sieci prezentacja power pointBezpieczeństwo w sieci prezentacja power point
Bezpieczeństwo w sieci prezentacja power point
 

Similar to 07

Here is the assignment5.java file -You are required, but not limi.pdf
Here is the assignment5.java file -You are required, but not limi.pdfHere is the assignment5.java file -You are required, but not limi.pdf
Here is the assignment5.java file -You are required, but not limi.pdf
mallik3000
 
ECET 370 Effective Communication/tutorialrank.com
 ECET 370 Effective Communication/tutorialrank.com ECET 370 Effective Communication/tutorialrank.com
ECET 370 Effective Communication/tutorialrank.com
jonhson275
 
ECET 370 Education Planning--ecet370.com
 ECET 370 Education Planning--ecet370.com ECET 370 Education Planning--ecet370.com
ECET 370 Education Planning--ecet370.com
WindyMiller46
 
ECET 370 Redefined Education--ecet370.com
ECET 370 Redefined Education--ecet370.comECET 370 Redefined Education--ecet370.com
ECET 370 Redefined Education--ecet370.com
agathachristie210
 
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
 
ECET 370 Invent Yourself/newtonhelp.com
ECET 370 Invent Yourself/newtonhelp.comECET 370 Invent Yourself/newtonhelp.com
ECET 370 Invent Yourself/newtonhelp.com
lechenau124
 
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 Success Begins/Newtonhelp.com
ECET 370 Success Begins/Newtonhelp.comECET 370 Success Begins/Newtonhelp.com
ECET 370 Success Begins/Newtonhelp.com
ledlang1
 
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
 
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 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
 
Chef for beginners module 5
Chef for beginners   module 5Chef for beginners   module 5
Chef for beginners module 5
Chef
 
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
 

Similar to 07 (13)

Here is the assignment5.java file -You are required, but not limi.pdf
Here is the assignment5.java file -You are required, but not limi.pdfHere is the assignment5.java file -You are required, but not limi.pdf
Here is the assignment5.java file -You are required, but not limi.pdf
 
ECET 370 Effective Communication/tutorialrank.com
 ECET 370 Effective Communication/tutorialrank.com ECET 370 Effective Communication/tutorialrank.com
ECET 370 Effective Communication/tutorialrank.com
 
ECET 370 Education Planning--ecet370.com
 ECET 370 Education Planning--ecet370.com ECET 370 Education Planning--ecet370.com
ECET 370 Education Planning--ecet370.com
 
ECET 370 Redefined Education--ecet370.com
ECET 370 Redefined Education--ecet370.comECET 370 Redefined Education--ecet370.com
ECET 370 Redefined Education--ecet370.com
 
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
 
ECET 370 Invent Yourself/newtonhelp.com
ECET 370 Invent Yourself/newtonhelp.comECET 370 Invent Yourself/newtonhelp.com
ECET 370 Invent Yourself/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 Success Begins/Newtonhelp.com
ECET 370 Success Begins/Newtonhelp.comECET 370 Success Begins/Newtonhelp.com
ECET 370 Success Begins/Newtonhelp.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
 
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 Redefined Education--ecet370helps.com
ECET 370 HELPS Redefined Education--ecet370helps.comECET 370 HELPS Redefined Education--ecet370helps.com
ECET 370 HELPS Redefined Education--ecet370helps.com
 
Chef for beginners module 5
Chef for beginners   module 5Chef for beginners   module 5
Chef for beginners module 5
 
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
 

More from liankei

Lo 19
Lo 19Lo 19
Lo 19
liankei
 
Lo 18
Lo 18Lo 18
Lo 18
liankei
 
Lo 13
Lo 13Lo 13
Lo 13
liankei
 
Lo 12
Lo 12Lo 12
Lo 12
liankei
 
Lo 11
Lo 11Lo 11
Lo 11
liankei
 
Lo 06
Lo 06Lo 06
Lo 06
liankei
 
Lo 05
Lo 05Lo 05
Lo 05
liankei
 
Lo 04
Lo 04Lo 04
Lo 04
liankei
 
Lo 01
Lo 01Lo 01
Lo 01
liankei
 
Lo 16
Lo 16Lo 16
Lo 16
liankei
 
Lo 15
Lo 15Lo 15
Lo 15
liankei
 
Lo 09
Lo 09Lo 09
Lo 09
liankei
 
Lo 08
Lo 08Lo 08
Lo 08
liankei
 
Lo 03
Lo 03Lo 03
Lo 03
liankei
 
Lo 20
Lo 20Lo 20
Lo 20
liankei
 
Lo19
Lo19Lo19
Lo19
liankei
 
Lo20
Lo20Lo20
Lo20
liankei
 
Lo17
Lo17Lo17
Lo17
liankei
 
Lo18
Lo18Lo18
Lo18
liankei
 
Lo15
Lo15Lo15
Lo15
liankei
 

More from liankei (20)

Lo 19
Lo 19Lo 19
Lo 19
 
Lo 18
Lo 18Lo 18
Lo 18
 
Lo 13
Lo 13Lo 13
Lo 13
 
Lo 12
Lo 12Lo 12
Lo 12
 
Lo 11
Lo 11Lo 11
Lo 11
 
Lo 06
Lo 06Lo 06
Lo 06
 
Lo 05
Lo 05Lo 05
Lo 05
 
Lo 04
Lo 04Lo 04
Lo 04
 
Lo 01
Lo 01Lo 01
Lo 01
 
Lo 16
Lo 16Lo 16
Lo 16
 
Lo 15
Lo 15Lo 15
Lo 15
 
Lo 09
Lo 09Lo 09
Lo 09
 
Lo 08
Lo 08Lo 08
Lo 08
 
Lo 03
Lo 03Lo 03
Lo 03
 
Lo 20
Lo 20Lo 20
Lo 20
 
Lo19
Lo19Lo19
Lo19
 
Lo20
Lo20Lo20
Lo20
 
Lo17
Lo17Lo17
Lo17
 
Lo18
Lo18Lo18
Lo18
 
Lo15
Lo15Lo15
Lo15
 

Recently uploaded

Removing Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software FuzzingRemoving Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software Fuzzing
Aftab Hussain
 
“I’m still / I’m still / Chaining from the Block”
“I’m still / I’m still / Chaining from the Block”“I’m still / I’m still / Chaining from the Block”
“I’m still / I’m still / Chaining from the Block”
Claudio Di Ciccio
 
Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !
KatiaHIMEUR1
 
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
名前 です男
 
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...
James Anderson
 
20240609 QFM020 Irresponsible AI Reading List May 2024
20240609 QFM020 Irresponsible AI Reading List May 202420240609 QFM020 Irresponsible AI Reading List May 2024
20240609 QFM020 Irresponsible AI Reading List May 2024
Matthew Sinclair
 
Mind map of terminologies used in context of Generative AI
Mind map of terminologies used in context of Generative AIMind map of terminologies used in context of Generative AI
Mind map of terminologies used in context of Generative AI
Kumud Singh
 
Pushing the limits of ePRTC: 100ns holdover for 100 days
Pushing the limits of ePRTC: 100ns holdover for 100 daysPushing the limits of ePRTC: 100ns holdover for 100 days
Pushing the limits of ePRTC: 100ns holdover for 100 days
Adtran
 
Monitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR EventsMonitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR Events
Ana-Maria Mihalceanu
 
Building RAG with self-deployed Milvus vector database and Snowpark Container...
Building RAG with self-deployed Milvus vector database and Snowpark Container...Building RAG with self-deployed Milvus vector database and Snowpark Container...
Building RAG with self-deployed Milvus vector database and Snowpark Container...
Zilliz
 
Artificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopmentArtificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopment
Octavian Nadolu
 
Introducing Milvus Lite: Easy-to-Install, Easy-to-Use vector database for you...
Introducing Milvus Lite: Easy-to-Install, Easy-to-Use vector database for you...Introducing Milvus Lite: Easy-to-Install, Easy-to-Use vector database for you...
Introducing Milvus Lite: Easy-to-Install, Easy-to-Use vector database for you...
Zilliz
 
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdfUnlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
Malak Abu Hammad
 
“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...
“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...
“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...
Edge AI and Vision Alliance
 
Uni Systems Copilot event_05062024_C.Vlachos.pdf
Uni Systems Copilot event_05062024_C.Vlachos.pdfUni Systems Copilot event_05062024_C.Vlachos.pdf
Uni Systems Copilot event_05062024_C.Vlachos.pdf
Uni Systems S.M.S.A.
 
How to Get CNIC Information System with Paksim Ga.pptx
How to Get CNIC Information System with Paksim Ga.pptxHow to Get CNIC Information System with Paksim Ga.pptx
How to Get CNIC Information System with Paksim Ga.pptx
danishmna97
 
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
SOFTTECHHUB
 
Large Language Model (LLM) and it’s Geospatial Applications
Large Language Model (LLM) and it’s Geospatial ApplicationsLarge Language Model (LLM) and it’s Geospatial Applications
Large Language Model (LLM) and it’s Geospatial Applications
Rohit Gautam
 
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
Neo4j
 
A tale of scale & speed: How the US Navy is enabling software delivery from l...
A tale of scale & speed: How the US Navy is enabling software delivery from l...A tale of scale & speed: How the US Navy is enabling software delivery from l...
A tale of scale & speed: How the US Navy is enabling software delivery from l...
sonjaschweigert1
 

Recently uploaded (20)

Removing Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software FuzzingRemoving Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software Fuzzing
 
“I’m still / I’m still / Chaining from the Block”
“I’m still / I’m still / Chaining from the Block”“I’m still / I’m still / Chaining from the Block”
“I’m still / I’m still / Chaining from the Block”
 
Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !
 
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
 
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...
 
20240609 QFM020 Irresponsible AI Reading List May 2024
20240609 QFM020 Irresponsible AI Reading List May 202420240609 QFM020 Irresponsible AI Reading List May 2024
20240609 QFM020 Irresponsible AI Reading List May 2024
 
Mind map of terminologies used in context of Generative AI
Mind map of terminologies used in context of Generative AIMind map of terminologies used in context of Generative AI
Mind map of terminologies used in context of Generative AI
 
Pushing the limits of ePRTC: 100ns holdover for 100 days
Pushing the limits of ePRTC: 100ns holdover for 100 daysPushing the limits of ePRTC: 100ns holdover for 100 days
Pushing the limits of ePRTC: 100ns holdover for 100 days
 
Monitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR EventsMonitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR Events
 
Building RAG with self-deployed Milvus vector database and Snowpark Container...
Building RAG with self-deployed Milvus vector database and Snowpark Container...Building RAG with self-deployed Milvus vector database and Snowpark Container...
Building RAG with self-deployed Milvus vector database and Snowpark Container...
 
Artificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopmentArtificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopment
 
Introducing Milvus Lite: Easy-to-Install, Easy-to-Use vector database for you...
Introducing Milvus Lite: Easy-to-Install, Easy-to-Use vector database for you...Introducing Milvus Lite: Easy-to-Install, Easy-to-Use vector database for you...
Introducing Milvus Lite: Easy-to-Install, Easy-to-Use vector database for you...
 
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdfUnlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
 
“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...
“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...
“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...
 
Uni Systems Copilot event_05062024_C.Vlachos.pdf
Uni Systems Copilot event_05062024_C.Vlachos.pdfUni Systems Copilot event_05062024_C.Vlachos.pdf
Uni Systems Copilot event_05062024_C.Vlachos.pdf
 
How to Get CNIC Information System with Paksim Ga.pptx
How to Get CNIC Information System with Paksim Ga.pptxHow to Get CNIC Information System with Paksim Ga.pptx
How to Get CNIC Information System with Paksim Ga.pptx
 
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
 
Large Language Model (LLM) and it’s Geospatial Applications
Large Language Model (LLM) and it’s Geospatial ApplicationsLarge Language Model (LLM) and it’s Geospatial Applications
Large Language Model (LLM) and it’s Geospatial Applications
 
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
 
A tale of scale & speed: How the US Navy is enabling software delivery from l...
A tale of scale & speed: How the US Navy is enabling software delivery from l...A tale of scale & speed: How the US Navy is enabling software delivery from l...
A tale of scale & speed: How the US Navy is enabling software delivery from l...
 

07

  • 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