In factory pattern we create object without exposing the creation logic to client and the client use the same common interface to create new type of…