logo

Object Oriented Programming Assignment 2022

   

Added on  2022-02-17

26 Pages4542 Words15 Views
ASSIGNMENT 2 FRONT SHEET
Qualification BTEC Level 5 HND Diploma in Computing
Unit number and title Unit 20: Advanced Programming
Submission date Date Received 1st submission
Re-submission Date Date Received 2nd submission
Student Name Student ID
Class Assessor name
Student declaration
I certify that the assignment submission is entirely my own work and I fully understand the consequences of plagiarism. I understand that
making a false declaration is a form of malpractice.
Student’s signature
Grading grid
P3 P4 M3 M4 D3 D4
Object Oriented Programming Assignment 2022_1
Summative Feedback: Resubmission Feedback:
Grade: Assessor Signature: Date:
Internal Verifier’s Comments:
Signature & Date:
Object Oriented Programming Assignment 2022_2
Table of Contents
I. Introduction...........................................................................................................................................4
II. Implement code applying design patterns.........................................................................................5
1. P3 Build an application derived from UML class diagrams......................................................................5
2. M3 Develop code that implements a design pattern for a given purpose.................................................7
III. Investigate scenarios with respect to design patterns.....................................................................14
1. P4 Discuss a range of design patterns with relevant examples of creational, structural and behavioral
pattern types........................................................................................................................................................14
a. What is Design Patterns?..........................................................................................................................................14
b. Creational Patterns....................................................................................................................................................14
c. Structural Pattern......................................................................................................................................................18
d. Behavioral Pattern.....................................................................................................................................................21
2. M4 Reconcile the most appropriate design pattern from a range with a series of given scenarios......24
a. Benefits of Pattern Builder............................................................................................................................... 24
b. Differences of builder pattern and other design patterns..................................................................................24
c. Why we choose builder patterns to develop scenario?.....................................................................................25
Bibliography........................................................................................................................................26
Table Of Figures
Figure 1: Car ticket Class diagram................................................................................................................................6
Figure 2: Itialize interface variables........................................................................................................................7
Figure 3: Initialize the types of seats included in the ticket.........................................................................................7
Figure 4: Initialize foods and drinks.............................................................................................................................8
Figure 5: Set sizes and prices for bread and drink.......................................................................................................8
Figure 6: Install items..................................................................................................................................................9
Figure 7: Install Show Items.........................................................................................................................................9
Figure 8: Initialize orders for customers....................................................................................................................10
Figure 9: Program implementation............................................................................................................................10
Figure 10: Program Result.........................................................................................................................................11
Figure 11: Factory Method class diagram..................................................................................................................15
Figure 12:Prototype Pattern class diagram................................................................................................................16
Figure 13: Builder pattern class diagram...................................................................................................................17
Figure 14: Decorator Pattern class diagram...............................................................................................................18
Figure 15: Flyweight Pattern class diagram...............................................................................................................19
Figure 16: Proxy Pattern class diagram......................................................................................................................20
Figure 17: Mediator Pattern class diagram................................................................................................................21
Figure 18:Iterator Pattern class diagram...................................................................................................................22
Figure 19: State Pattern class diagram......................................................................................................................23
Object Oriented Programming Assignment 2022_3
I. Introduction
- My team is now separated and perform similar tasks in parallel. I will choose one of the real scenarios that
your team introduced about DP in previous phase, then implement that scenario based on the corresponding
class diagram your team created. I may need to amend the diagram if it is needed for your implementation. In
additional, I should discuss a range of DPs related / similar to your DP, evaluate them against your scenario
and justify your choice.
- In the end, I need to write a report with the following content:
A final version of the class diagram based on chosen scenario which has potential of using DP.
Result of a small program implemented based on the class diagram, explain how you translate from design
diagram to code.
Discussion of a range of DPs related / similar to your DP, evaluate them against your scenario and justify
your choice (why your DP is the most appropriate in that case).
Object Oriented Programming Assignment 2022_4
II. Implement code applying design patterns.
1. P3 Build an application derived from UML class diagrams.
- As introduced in the Design patterns in the previous task. We have introduced to you 3 types of DP of 23 DP
models.
- Among those 23 DP models, we have introduced to you 3 models representing 3 main groups of DP:
creational, structural and behavioral.
- 3 DP models that my group introduced in the previous task are: Builder (creational group), Flywiegh
(structural group) and Stragery (behavioral group).
- At the request of the mission this time I decided to choose a realistic situation that was to use the
Parttern Builder for ordering food at a fast food restaurant.
- Based on the requirements of the project, I prepared a realistic scenario to introduce the Builder Pattern in the
previous task.
- Scenatio is as follows:
Spiderman
Order at a fast food system
- I received an email from the manager of the south bus terminal company, who heard about your success. He
wants you to create a new OMS for your ticketing system. For the first milestones, he identified a number of
requirements that need to be met by your OMS:
Car ticketing system, Car ticket booking (vip or regular seats) as well as some sandwiches (Big bread,
Small bread) and some drinks (Coca and Pepsi) besides customers Can choose the size they want them to.
The system will be able to represent these products.
All priced products and breads have specific nutrition.
Each bread contains less bread and sauces. It can be selected size of bread supplement (Big, Small), can be
ordered several times.
Breads with certain topping combinations have names, for example: large bread and small bread. Names
should be on the bill. You do not need to automatically detect names for combinations if they are not
explicitly needed in order.
Finally, after finishing the order, the system will display the product information of the customer and the
total amount on the invoice.
- The manager sent you the fastfood menu card to better understand their available items:
Ticket VIP
NORMAL
$250
$150
BREAD BREADBIG
BREADSMALL
$50
$35
DRINK COCA
PEPSI
$50
$35
SIZE BIG
SMALL
$50
$35
Object Oriented Programming Assignment 2022_5
- Based on the scenario the company manager requested. We have planned to perform that scenario and choose
the most suitable DP to execute that scenario.
- After reaching agreement, we decided to choose the Builder Pattern to design that table script.
- Below is the class diagram that we have defined to implement the above project.
Figure 1: Car ticket Class diagram.
Object Oriented Programming Assignment 2022_6

End of preview

Want to access all the pages? Upload your documents or become a member.

Related Documents
Unit 20: Advanced Programming Assignment
|28
|4015
|256

Higher Nationals in Computing
|20
|3323
|33

Unit 43: Internet of Things PDF
|38
|5839
|237

Unit 1: Programming Submission
|58
|8377
|153

The assignment submission is entirely my own work and I understand the consequences of plagiarism
|75
|6901
|487

Database Design & Development Assignment 2
|75
|6962
|200