I've been struggling with this assignment for hours now. I think it's important that I summarize the assignment before asking for help.

The first task was to create the class MyMathOps, to handle the cube of integers or doubles, the square of integers or doubles, and to handle finding the max and min of a group of integers or a group of doubles.

Writing this class was rather easy, I don't think I have any problems with that part of the assignment.

The next step was to create a MyMathOpsTest class that would utilize the MyMathOps class through a menu. Writing the menu was no problem, what has confused me is the following two steps.

The following methods should be called by the selection in the menu: squareTheNumber(), cubeTheNumber(), raiseTheNumber(), maximumNumber(), and minimumNumber()

These methods should ask the user for input, then pass that input to the appropriate Math or MyMathOps method and print the result.

With that in mind. Let me now explain what I've done and the error I'm getting.

Here is my MyMathOps class. No real problems creating this.(But I'm so often wrong I'll post it anyways)

public class myMathOps{ public static int squareInt (int x) { return (x * x); }//end square int method public static double squareDouble (double x) { return (x * x); }//end square double method public static int cubeInt (int x) { return (x * x * x); }//end cube int method public static double cubeDouble (double x) { return (x * x * x); }//end cube double method public static int maximumInt (int x, int y, int z) { int maxValue = x; if (y > maxValue) maxValue = y; if (z > maxValue) maxValue = z; if (x > maxValue) maxValue = x; return Math.max( x, Math.max(y, z)); }//end int maximum method public static double maximumDouble (double x, double y, double z) { double maxValue = x; if (y > maxValue) maxValue = y; if (z > maxValue) maxValue = z; if (x > maxValue) maxValue = x; return Math.max( x, Math.max(y, z)); }//end double maximum method public static double minimumDouble (double x, double y, double z) { double minValue = x; if (y < minValue) minValue = y; if (z < minValue) minValue = z; if (x < minValue) minValue = x; return Math.min( x, Math.min(y, z)); }//end double minimum method public static int minimum(int x, int y, int z) { int minValue = x; if (y < minValue) minValue = y; if (z < minValue) minValue = z; if (x < minValue) minValue = x; return Math.min( x, Math.min(y, z)); }//end int minimum method }//End myMathOps Class

The problem I've encountered is in the test (MyMathOpsTest) class.

import java.util.Scanner; public class myMathOpsTest { public static double squareTheNumber() { System.out.print("Enter the number:"); double number = keyBd.nextDouble(); if (number == Math.floor(number)) //this line will determine if the number is an integer or a double. int result = myMathOps.squareInt((int)number); System.out.printf("The square of the number is: " + result); if (number != Math.floor(number)) double result1 = myMathOps.squareDouble(number); System.out.printf("The Square of the number is: " + result1); }//end method public static double cubeTheNumber() { System.out.print("Enter the number you wish to cube"); double numberCubed = keyBd.nextDouble(); if (numberCubed == Math.floor(numberCubed)) //this line will determine if the number is an integer or a double. int result = myMathOps.cubeInt((int)numberCubed); System.out.printf("The cube of your number is %.4f" , result); if (numberCubed != Math.floor(numberCubed)) double result1 = myMathOps.cubeDouble(numberCubed); System.out.printf("The cube of your number is " + result1); }//end method public static double raiseTheNumber() { System.out.print("Enter the number you wish to raise.(base number):"); double basenumber = keyBd.nextDouble(); System.out.print("Enter the number you are raising it too(the power):"); double powernumber = keyBd.nextDouble(); double result = Math.pow(basenumber,powernumber); System.out.println("The result of " + basenumber + " to the power of " + powernumber + " is: " + result); }//end method public static double maximumNumber() { System.out.print("Enter the first number, start with a double if the list has them:"); double n1 = keyBd.nextDouble(); if (n1 == Math.floor(n1)) //Testing to see if first number is an integer. If it is, the rest must be integers System.out.print("Enter the Second number:"); int num2 = keyBd.nextInt(); System.out.print("Enter the Third number:"); int num3 = keyBd.nextInt(); int result = myMathOps.maximumInt((int)n1,num2,num3); System.out.printf("The maximum is: %.4f", result); if (n1 != Math.floor(n1)) System.out.print("Enter the Second number:"); double n2 = keyBd.nextDouble(); System.out.print("Enter the Third number:"); double n3 = keyBd.nextDouble(); double result1 = myMathOps.maximumDouble(n1, n2, n3); }//end method public static double minimumNumber() { System.out.print("Enter the first number(Do not start with an integer if it's a list of doubles):"); double numberMin1 = keyBd.nextDouble(); int numberIntMin1 = 0; if (numberMin1 == Math.floor(numberMin1)) //Testing to see if first number is an integer. If it is, the rest must be integers numberMin1 = Math.floor(numberMin1); System.out.print("Enter the Second number:"); int numberIntMin2 = keyBd.nextInt(); System.out.print("Enter the Third number:"); int numberIntMin3 = keyBd.nextInt(); int result = myMathOps.minimumInt((int)numberMin1, numberIntMin2, numberIntMin3); System.out.printf("The minimum is %.4f", result); if (numberMin1 != Math.floor(numberMin1)) System.out.print("Enter the second number:"); double numberDoubleMin2 = keyBd.nextDouble(); System.out.print("Enter the third number:"); double numberDoubleMin3 = keyBd.nextDouble(); double result1 = myMathops.minimumDouble(numberMin1, numberDoubleMin2, numberDoubleMin3); ystem.out.printf("The minimum is %.4f", result1); }//end method public static void main(String [] args) { Scanner keyBd = new Scanner( System.in ); char selection = ' '; do{ //create the menu System.out.println("Select from the menu:"); System.out.println("1. Square a Number"); System.out.println("2. Cube a Number"); System.out.println("3. Raise a Number to a Power"); System.out.println("4. Maximum of Three Numbers"); System.out.println("5. Minimum of Three Numbers"); System.out.println("6. Exit"); System.out.print ("Selection:"); //get the menu selection selection = keyBd.next().charAt(0); switch( selection ) { case 1://square the number squareTheNumber(); break; case 2://Cube the number cubeTheNumber(); break; case 3://Raise the number to a Power. raiseTheNumber(); break; case 4://Find the maximum of three numbers. maximumNumber(); break; case 5://Find the minimum of three numbers. minimumNumber(); break; case 6://Exit the program. break; default: System.out.println("Invalid selection!"); System.out.println("Press a key+<Enter> to continue..."); keyBd.next(); } }while(selection != '6'); }//end main }//end myMathOpsTest class

Specifically, my issue is this error:

myMathOpsTest.java:21: error: '.class' expected int result = myMathOps.squareInt((int)number); ^ myMathOpsTest.java:21: error: not a statement int result = myMathOps.squareInt((int)number); ^ myMathOpsTest.java:21: error: illegal start of expression int result = myMathOps.squareInt((int)number); ^ myMathOpsTest.java:21: error: ';' expected int result = myMathOps.squareInt((int)number); ^ myMathOpsTest.java:26: error: '.class' expected double result1 = myMathOps.squareDouble(number); ^ myMathOpsTest.java:26: error: not a statement double result1 = myMathOps.squareDouble(number); ^ myMathOpsTest.java:26: error: illegal start of expression double result1 = myMathOps.squareDouble(number); ^ myMathOpsTest.java:26: error: ';' expected double result1 = myMathOps.squareDouble(number); ^ myMathOpsTest.java:37: error: '.class' expected int result = myMathOps.cubeInt((int)numberCubed); ^ myMathOpsTest.java:37: error: not a statement int result = myMathOps.cubeInt((int)numberCubed); ^ myMathOpsTest.java:37: error: illegal start of expression int result = myMathOps.cubeInt((int)numberCubed); ^ myMathOpsTest.java:37: error: ';' expected int result = myMathOps.cubeInt((int)numberCubed); ^ myMathOpsTest.java:42: error: '.class' expected double result1 = myMathOps.cubeDouble(numberCubed); ^ myMathOpsTest.java:42: error: not a statement double result1 = myMathOps.cubeDouble(numberCubed); ^ myMathOpsTest.java:42: error: illegal start of expression double result1 = myMathOps.cubeDouble(numberCubed); ^ myMathOpsTest.java:42: error: ';' expected double result1 = myMathOps.cubeDouble(numberCubed);

I've no idea why this error is happening. Or honestly if I'm even on the right track to solve this assignment. I figured that what I did is what he meant by asking me to create and then call these methods.