so i have to write regression line program which is hard enough seeing as i just started so i need help,
1st thing is how do i write a loop for mouse clicks of any number,
then write the average of whatever the amount of mouseclicks, thanks!
Are you using the Zelle graphics module? If you are, I think you should try the following strategy. Create a GraphWin, then in one of the corners make a button by drawing a rectangle, and inside it printing "Compute" or something like that. The API for the graphics module I am thinking of can be found here. This should tell you how to draw lines, points, rectangles, text, and all that other stuff.
After making the "button" also create an empty list called 'points' and set a flag variable to false. Now run a loop while the flag variable is false. In every iteration of the loop, do a getMouse() call. This function returns a Point object which tells you where on the GraphWin the mouse was pressed. Once you get the Point object, look at it: if it was inside the range of the "button" then set the flag to true (which causes the loop to exit). Otherwise, append the Point to our 'points' list and draw a point or small circle on that spot on the GraphWin. After the loop, use the 'points' list to do the linear regression.
In code, it would sort of look like this:
width, height = 300, 300
gw = GraphWin("Linear Regression", width, height, true)
make_button(gw) # draw the button on the GraphWin
points = 
quit_loop = false
while not quit_loop:
p = getMouse()
quit_loop = user_clicked_button(p) # check for button clicks
if not quit_loop:
draw_point(p, gw) # draw the Point on the GraphWin
compute_regression(points) # compute the linear regression
Of course, you'd need to come up with the make_button(), user_clicked_button(), draw_point(), and compute_regression() functions on your own.