Question
In other words, it should calculate the squares from 1 to 10, add them and print them.
And do the same for the cubes from 1 to 10.
You must use the following main method:
public static void main(String[ ] args) {
int totalSquares = sumSquares(10);
System.out.println("The sum of the squares from 1 to 10 is " + totalSquares);
System.out.println();
int totalCubes = sumCubes(10);
System.out.println("The sum of the cubes from 1 to 10 is " + totalCubes);
}
You will have to create method headers for sumSquares and sumCubes that will allow them to be called as specified in the main method.
Note that each method must accept a value from the method call that it will use in performing the calculation.
This value is the is used to determine how many squares and cubes to calculate.
The method headers must also allow the methods to return a value of the correct type.
Solution Preview
This material may consist of step-by-step explanations on how to solve a problem or examples of proper writing, including the use of citations, references, bibliographies, and formatting. This material is made available for the sole purpose of studying and learning - misuse is strictly forbidden.
public class squaresAndCubes {public static void main(String[ ] args) {
int totalSquares = sumSquares(10);
System.out.println("The sum of the squares from 1 to 10 is " + totalSquares);
System.out.println();...