私のCSクラスのプログラムを作成し、基本的にプログラム(インストラクターによって作成された)は、本のタイトルと著者を作成するプログラムを作成し、コードは私のプログラムを介して実行され、本のクラスと著者のクラスを構築します。私の問題は、インストラクターのコードの12行目で、著者である「a3」が本のクラスで呼び出され、2番目のクラスコンストラクターで最初のクラスを呼び出す方法がわからないことです。そのまま、「トリプル ドットが必要です」というエラーが表示されます。
//my code
public class Author {
String firstName;
String lastName;
//variables
public Author (String a) {
firstName = a;
}
public Author (String a, String b) {
firstName = a;
lastName = b;
}
}
public class Book {
String Title;
String a;
//variables
public Book (String c, Author) {
Title = c;
}
public Book () {
}
}
// instructor's code
void setup() {
Book [] allTheBooks = new Book[30];
int score = 6;
int tScore = 0;
System.out.println( "Attempting constructors:" );
Author a1 = new Author( "Ballard", "J.G." );
Author a2 = new Author( "Eggers", "Dave" );
Author a3 = new Author( "Catton", "Eleanor" );
Author a4 = new Author( "Adler", "Renata" );
System.out.println( " - Author constructors seem functional: 3/3" );
allTheBooks[1] = new Book( "The Circle" );
allTheBooks[2] = new Book( "The Luminaries", a3 );
allTheBooks[3] = new Book();
allTheBooks[4] = new Book( "Pitch Dark" );
allTheBooks[5] = new Book( "Speedboat" );
allTheBooks[6] = new Book();
allTheBooks[7] = new Book( "The Dissident Gardens" );
System.out.println( " - Book constructors seem functional: 3/3" );
}