Get Instant Help From 5000+ Experts For
question

Writing: Get your essay and assignment written from scratch by PhD expert

Rewriting: Paraphrase or rewrite your friend's essay with similar meaning at reduced cost

Editing:Proofread your work by experts and improve grade at Lowest cost

And Improve Your Grades
myassignmenthelp.com
loader
Phone no. Missing!

Enter phone no. to receive critical updates and urgent messages !

Attach file

Error goes here

Files Missing!

Please upload all relevant files for quick & complete assistance.

Guaranteed Higher Grade!
Free Quote
wave
Developing Member Club Website with Java OOP Design and Design Patterns

Object-Oriented Design with Java

Q1 A web developer, John, wants to develop a Member Club Website (MCW) for his company. There are two kinds of members, normal member (Member) and gold member (GoldMemeber). Finally, he designs the following class diagrams to implement MCW:

Requirements:

• This Member should have three attributes: id, name and discount.
• Attribute id: Member ID number.
• Attribute name: Member's name.
• Attribute discount: Discount for a normal member, by default, it is set to 10 to represent the discount is less 10%.
• Method getDiscount( ): To return the current discount of a member.
• Method showStatus( ): To return the current status of a member.

The JavaScript subclass GoldMember (inherit from Member) represents a gold member in MCW with the following requirements on top of Member:

• This GoldMember has one more attribute: bonuspoint.
• Attribute bonuspoint: The default value of bonuspoint is 0.
• Attribute discount: The attribute discount will be changed according to the value of bonuspoint. The requirement will be stated in the method getDiscount().

After reviewing his classes, Peter’s supervisor commented that his program did not conform to the Open-Closed Principle. He is advised to modify the design of the program so that it can be easily extended to handle new types of weapons.

(a) Draw a class diagram to show the new design of the program which conforms to the Open- Closed Principle. Show all the required classes, attributes, methods, constructors and the relationships between the classes.

(b) Write the Java codes for implementing the classes which have been changed or added in the new design given in the class design to the answer in

Q2 Refer to Adapter Design Pattern to answer the following question.

(a) Draw a class diagram to illustrate the Object Adapter Design Pattern. Your diagram should show all necessary methods, associations between classes, inheritance(s), and note(s) for explaining the codes for the adapter’s method(s).

(b) An online forum is redesigning their forum navigation system to facilitate better accessing to forum pages. The new navigation system is designed to use the PageAccess interface to let user access difference message page.

You are asked to implement a Java class named PageAdapter.java, which converts the interface of the PageControl class into the PageAccess interface that is used by the new navigation system.

(c) Draw a class diagram of your design in your answer to. Show all the required classes/interface(s), the associations between the classes/interface(s), and the required methods of the adapter class.

Q3 Refer to Memento Design Pattern to answer the following question.

(a) State and briefly explain the roles in the Memento Design Pattern.

(b) Crescent College is developing a new student record system with your development team. You are asked to apply the Memento Design Pattern to save and restore the state of objects of the Student class defined below. Implement a Java class StudentMemento with the constructor and restore methods which are used to respectively save and restore the state of a Student object.

(c) Write a CareTaker class to use the StudentMemento class implemented in your answer to . Your CareTaker class must provide 3 methods: constructor, saveStudent(Student std) and undo. The saveStudent(Student std) method saves the state of a Student object by creating a StudentMemento object and stores the StudentMemento object. The undo method removes a StudentMemento object and uses the StudentMemento object to restore the associated Student object to its previous state.

(d) Draw a suitable class diagram to illustrate the design of your implementation for the answer to. In your diagram, show all the classes and associations which are required for the Memento Design Pattern.

(e) Write a test driver program named TestMemento.java to test the CareTaker class and the StudentMemento classes as described. Apply the CareTaker class in the test program so that all the update operations can be undoable.

support
close