Added some logic so solving by iterational method
Added Method class with static method