https://github.com/truecodersio/factory-pattern
.NET 6.0 template project for the Factory Pattern exercise at TrueCoders
https://github.com/truecodersio/factory-pattern
Last synced: about 1 year ago
JSON representation
.NET 6.0 template project for the Factory Pattern exercise at TrueCoders
- Host: GitHub
- URL: https://github.com/truecodersio/factory-pattern
- Owner: truecodersio
- Created: 2022-09-07T02:03:12.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2025-03-28T19:17:20.000Z (over 1 year ago)
- Last Synced: 2025-03-31T10:06:15.390Z (over 1 year ago)
- Language: C#
- Size: 111 KB
- Stars: 0
- Watchers: 2
- Forks: 368
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
Complete the console app to utilize factory pattern by taking a user’s input of how many tires are on a vehicle and, based on their input, creates that type of vehicle. Complete this using an interface. You must have at least 2 subclasses. For instance, if I type 4 into the console, the program would create a car or truck, or if someone types 2 it would create a motorcycle.
Feel free to use something other than vehicles if you want to be creative, but the other constraints still apply!
+ Create an Interface named IVehicle that has a stubbed out public void Drive method.
+ Create 2 new public classes that will conform to IVehicle.
+ Example) Car, Motorcycle, BigRig
> Note: These classes must conform to IVehicle and implement the Drive() method - which will just Console.WriteLine(“Building a new Car!”)
Now we will make our static VehicleFactory class.
It will contain a static method GetVehicle(), that will return an IVehicle based on the amount of tires it’s given as a parameter
Call this functionality in the Main method.
Possible Answer:
https://github.com/mvdoyle/FactoryPattern