I have some code I wrote, it works, I would like to know how to make this loop without writing certain things 10 times and cant seem to do it. Can you help?

package linesrects;
import...