実験課題6
Exercise 6(課題6) See the section 1.11.1. "Package". Then create the ArrayPrinter class of Fig. 74 to array.utils package in the project chapter1debug. Further, create the following main and initArray method that initialize a specified array with a sequence from 1 to the array length (see the following figure depicts it). Then, show the sourcecode and execution result as the screenshot.
public static void initArray(int[] a) {
for (int i = 0; /* 考えてください */; i++) {
/* 考えてください */
}
}
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
int x = 0;
/*
このコメント部分に入力された文字列を整数型データに変換して、
変数xに代入するプログラムを考えてください。
*/
int[] arr = new int[x];
ArrayPrinter.printInt(arr);
ArrayPrinter.initArray(arr);
ArrayPrinter.printInt(arr);
}

(1.11.1.節をよく読み、プロジェクト名chapter1debugのJavaアプリケーションプロジェクトを作成して、図74に示すarray.utilsパッケージとそれに含まれるArrayPrinterクラスを作成し、さらに以下の要件を満たすinitArrayクラスメソッドをArrayPrinterクラスに追加しなさい。そしてChapter1debugクラスのmainメソッドを/**/で囲われたコメント文の箇所を穴埋めして完成させ、ソースコードと実行結果を報告しなさい。なおinitArrayクラスメソッドは引数として渡された配列データの0番目を1、1番目を2、n-1番目をnに初期化することが要件である。)