Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

by Java code: Define the hierarchy of products (vehicles)( Color, Make, Model, Year, Price, and NumberOfPassengers ). Use the factory method pattern to create the

by Java code:

  1. Define the hierarchy of products (vehicles)( Color, Make, Model, Year, Price, and NumberOfPassengers).
  2. Use the factory method pattern to create the different vehicles(Car, Moto, Truck, and Bicycle) Car and Truck have additional attributes: Engine, NumberOfDoors and VIN (Vehicle Identification). The Moto has additional attributes: Engine and VIN (Vehicle Identification). The Bicycle has an additional attribute: BicycleType (RoadBicycle or MountainBicycle) using an enumeration.
  3. Define the abstract factory pattern associated to the vehicle creation. In this part, you need to create a factory for each kind of vehicles.
  4. For the Car, we specialize by creating subclasses for the different kind of cars (SportsCar, LuxuryCar). We define a decorator to add some accessories to the car: MusicSystem, SunRoof, TouchScreen

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Professional IPhone And IPad Database Application Programming

Authors: Patrick Alessi

1st Edition

0470636173, 978-0470636176

Students also viewed these Databases questions

Question

Define and explain the purpose of financial statement analysis.

Answered: 1 week ago