1- This assignment can be done individually or in groups. Maximum group size is 3 persons per
2- Due date is February 7, 2021.
3- You have to upload the source files and screenshots of the outputs to the blackboard.
4- I prefer that you use Java to solve the assignments. If you do not like Java, then you can use
In the GoF book, List interface is defined as follows:
Question#2: In class, we studied that Bridge pattern and discussed the Shape example below.
Implement this example in Java. Assume that we want to control the thickness of Shape, i.e., to
set the thickness to either Thick or Thin. Add a getter method for Colour and getters and setters to
control the thickness. Then write a main method, in which you instantiate four instances of
Shape, 2 Rectangle and 2 Triangle: a red thick and a blue thin triangle, and a red thin and a blue
thick rectangle. Call the toString() method on all instances to print their colour and thickness.
Question#3: Design and implement a Java program using Abstract Factory and Singleton design
The program displays date and time in one of the following two formats:
The following is how the program works. In the beginning, the program asks the user what
display format that she wants. Then the program continuously asks the user to give one of the
following commands, and performs the corresponding task. Note that the program gets the
current date and time from the system clock (use the appropriate Java date and time operations
‘d’ : display current date
‘t’: display current time
‘q’: quit the program.
• In the program, there should be 2 product hierarchies: “DateObject” and “TimeObject”. Each
hierarchy should have format1 and format2 described above.
• Implement the concrete factories as singleton classes.
• Draw a UML class diagram for the program.
本网站支持淘宝 支付宝 微信支付 paypal等等交易。如果不放心可以用淘宝交易！
E-mail: email@example.com 微信:itcsdx