我正在构建一个程序,我们特别不允许在子模块中使用多个返回.
我想知道如何通过jimArea,ashtynArea并steveArea从子模块,areaCalc以便他们可以在主要使用.这是我所指的子模块,后面是完整的代码.
public static int areaCalc(double depth, double width, double length)
{
int jimArea = (int)(jimDepth * jimWidth * jimLength);
int steveArea = (int)(steveDepth * steveWidth * steveLength);
int ashtynArea = (int)(ashtynDepth * ashtynWidth * ashtynLength);
}
Run Code Online (Sandbox Code Playgroud)
这是完整的代码.最初我只是回到了区域,但事实证明我需要3个区域,所以我不知道如何在不做多次返回的情况下做到这一点.
import java.util.*;
public class PoolStorageCalculation
{
public static void main(String [] args)
{
Scanner sc = new Scanner(System.in);
System.out.println("Please enter the Depth of Steve's Pool in Metres.");
double steveDepth = sc.nextDouble();
System.out.println("Please enter the …Run Code Online (Sandbox Code Playgroud)