Clear, simple and elegant object-oriented code is important. Avoid the minimum possible solution; Consider maintainability and extensibility by the demonstration of appropriate abstractions. A solution using the fewest possible lines of code is not the best option.
Part 1. Visitor
Create an interface or abstract base class 'Shape'.
Implement three concrete Shapes: 'Circle', 'Rectangle', 'Triangle'.
Apply the visitor pattern to your data model.
Write an AreaVisitor that computes the area of the shapes.
Write a program that makes arbitrary instances of the data model and applies the AreaVisitor.
Part 2. Multi Power Point
A power switch is required that can turn on or off any number of appliances. An appliance is for example a Blender, a Toaster, or an Oven.
Other programmers have already written those appliances and you can't change their source code (e.g. to require them all to implement a particular interface), or extend from those classes.
Fortunately, each such appliance already has two methods to turn its particular appliance on and off. Unfortunately, all such methods were written by different people and have different names (examples: [url removed, login to view](), [url removed, login to view](), [url removed, login to view]()).
Write three third party appliances and put them in a separate package. It should be visible from the output of each appliance whether it is turned on or off (in its third-party vocabulary).
Make a representation of a Multi Power Point. You can plug in as many appliances as you wish and turn them on and off all at once, by turning the multi power point on() and off(). Consider how you would model a real multi power point and make appropriate design choices.
Write a program that demonstrates your Multi Power Point.
Part 3. Paper Scissors Rock
Paper Scissors Rock is a game for two players. Each player simultaneously opens his/her hand to display a symbol:
Fist equals rock,
Open hand equals paper,
Showing the index and middle finger equals scissors.
The winner is determined by the following schema:
paper beats (wraps) rock,
rock beats (blunts) scissors,
scissors beats (cuts) paper.
Write a program that plays Paper Scissors Rock between the computer and a real player.
You should be able to play the game n times before the program exits.
Good option is to generalize from these requirements to demonstrate clear, maintainable and extensible code.
8 freelanceria on tarjonnut keskimäärin 46 € tähän työhön
Hey client, I am a professional developer having a great passion for programming. I have good concepts about design pattern with industry experience.Waiting for your reply.