public abstract String LogisticType{get;}
public abstract int LogisticRange{get;set;}
public abstract int LogisticCost{get;set;}
class LogisticByRoad : Logistic
private readonly String _LogisticType;
private int _LogisticRange;
private int _LogisticCost;
public LogisticByRoad(int LogisticRange,int LogisticCost)
_LogisticRange=LogisticRange;
_LogisticCost=LogisticCost;
Console.WriteLine("**** step 3 : object of LogisticByRoad created and called the Constructor of LogisticByRoad");
public override String LogisticType
public override int LogisticRange
public override int LogisticCost
class LogisticByWater : Logistic
private readonly String _LogisticType;
private int _LogisticRange;
private int _LogisticCost;
public LogisticByWater(int LogisticRange,int LogisticCost)
_LogisticRange=LogisticRange;
_LogisticCost=LogisticCost;
public override String LogisticType
public override int LogisticRange
public override int LogisticCost
abstract class LogisticFactory
public abstract Logistic getLogistic();
class LogisticByRoadFactory : LogisticFactory
private int _LogisticRange;
private int _LogisticCost;
public LogisticByRoadFactory(int LogisticRange,int LogisticCost)
Console.WriteLine("\n**** step 1 :Constructor of LogisticByRoadFactory called");
_LogisticRange=LogisticRange;
_LogisticCost=LogisticCost;
public override Logistic getLogistic(){
Console.WriteLine("\n**** step 2 :getLogistic create the object of LogisticByRoad ");
return new LogisticByRoad(_LogisticRange,_LogisticCost);
class LogisticByWaterFactory : LogisticFactory
private int _LogisticRange;
private int _LogisticCost;
public LogisticByWaterFactory(int LogisticRange,int LogisticCost)
_LogisticRange=LogisticRange;
_LogisticCost=LogisticCost;
public override Logistic getLogistic(){
return new LogisticByWater(_LogisticRange,_LogisticCost);
public static void Main()
Console.WriteLine("Hello....");
Console.WriteLine("\nTypes of Transport \n Road and Water");
LogisticFactory factory=null;
Console.Write("\nEnter The Transport Type You Would Like To :");
string trans=Console.ReadLine();
factory = new LogisticByRoadFactory(2000, 3000);
factory = new LogisticByWaterFactory(100, 500);
Console.WriteLine("\n#####before calling getLogistic");
Logistic logistic=factory.getLogistic();
Console.WriteLine("\n#####after calling getLogistic ");
Console.WriteLine("\nYour Transoprt details are below : \n");
Console.WriteLine("\nTransport Type: {0}\nTransport Limit: {1}\nTransport Cost: {2}",
logistic.LogisticType, logistic.LogisticRange, logistic.LogisticCost);