Java Code Example: volume and surface of a cube

This program calculates the volume and the surface area of a cube in separate functions.

import java.util.Scanner;

public class VolumeAndSurfaceExample {
    static double getVolume(double a) {
        double volume;
        volume = a * a * a;
        return volume;
    }

    static double getSurface(double a) {
        double surface;
        surface = 6 * a * a;
        return surface;
    }

    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        double edgeLength;

        System.out.println("Please enter the edge length: ");
        edgeLength = scan.nextInt();

        scan.close();
    
        System.out.println("Volume: " + getVolume(edgeLength));
        System.out.println("Surface: " + getSurface(edgeLength));
    }
}
Output
Please enter the edge length: 
5
Volume: 125.0
Surface: 150.0