I tried to make this figure without hardcoding but failed miserably. I am a novice programmer, please help me with this problem. This is the figure.