I have the following function cube_vol() to calculate the volume of a cube. It gives me an error as follows:
Exception in thread "main" java.lang.Error: Unresolved compilation problem:
The method cube_vol(double) in the type Test is not applicable for the arguments ()
Could you please help me see what went wrong? Thank you.
import java.util.Scanner; public class Test { public static void main(String[] args) { // calling the function cube_vol(); } // Cube function public static double cube_vol(double sideCube) { printMe("What is the length of one of the sides: "); Scanner input = new Scanner(System.in); double sideCube = input.nextDouble(); double ans1 = cube_vol(sideCube); printMe("The cube's volume is: %.2f\n", ans1); double cubeVol = Math.pow(sideCube, 3); return cubeVol; } public static void printMe (String text) { System.out.println(text); } public static void printMe (String text, double value) { System.out.printf(text, value); } }