Incorporate the function methods square and sumOfSquares into a Java program (need to call sumOfSquares

from main method).

(a) Amend so that the sum of squares from 1 to 10 (i.e. using the value n = 10) is output to screen.

( Amend your program so that the user is asked to input the value of n before sum of squares is output to

screen.

© Further amend your program so that the user is repeatedly asked to input a value for n (and the sum of

squares output to screen) until -1 is input, which terminates the program.

i have had several attempts at this and cant find a solution...

this is the code i have so far:

public class sumofsquares { public static void main (String [] args) { int number, sum, square; Scanner Key = new Scanner(System.in); System.out.println("Please enter a number"); number = Key.nextInt(); } public static int square(int n) { return n*n; } public static int sumofsquares(int n) { int sum = 0; int i; for (i = 1; i<= n; i++) { sum = i + square(i); } return sum; System.out.println(+sum); } }

i am very new to java and could do with as much help as possible.

i have been trying for hours and nothing seems to work