0

Java プログラミング言語でコーディングする方法を勉強し始めたばかりです。

数値、変数、および式を引数としてプロシージャ呼び出しに渡すように指示する問題が発生しました。私が抱えている問題は、数値、変数、および式を引数としてプロシージャ呼び出しに渡そうとしたときにエラーが発生することです (27 エラーが発生しました)。

以下は私のコードです。誰かが私のコードの何が問題なのかを指摘していただければ幸いです。ありがとうございました。

public class test {

// this is the procedure definition
public static int computeCost ( int quantity , int price ) {
    return quantity * price;
}

public static void main ( String args[] ) 
    // passing numbers as arguments to the procedure call "cost"
    System.out.println ( computeCost ( 7 , 12 ) );

    // passing variables as arguments to the procedure call "cost"
    int a = 5;
    int b = 7;
    System.out.println ( computeCost ( a , b ) );

    // passing expressions as arguments to the procedure call "cost
    System.out.println ( computeCost ( 1 + 2 + 3 + 4, 5 + 6 + 7 + 8 ) );
}
}
4

4 に答える 4