私はこの質問に固執しています、私は本と呼ばれる1つのクラスと著者と呼ばれる別のクラスを持っています
本のクラスでは、タイトル、著者、価格、ISBNがあります
著者クラスでは、ファーストネーム、セカンドネーム、国籍があります
問題は、著者クラスと本クラスを接続することです.....。
TestClass --------
public class BookTest {
public static void main(String[] args) {
Author fullAuth = new Author("Bob", "Marly", "Russian");
Book bookInf = new Book("Alice", fullAuth ,60000,2000);
Student studInf = new Student("Ted", "21/10/1992", "Male","Simmonds Close 63","King Close 65","Computing", 12000);
System.out.println(fullAuth.getAuNational() +" "+ fullAuth.getAuFname ());
System.out.println(bookInf.getTitle() +" "+ bookInf.getPrice());
System.out.println(studInf.getName() +" "+ studInf.getName ());
}
}
ブッククラス------------
public class Book{
private double price;
private int isbn;
private String title;
private String author;
public Book (String title, String author, double price, int isbn){
this.author = author;
this.title = title;
this.price = price;
this.isbn = isbn;
}
public void setTitleBook(String title) {
this.title = title;
}
public String getTitle(){
return title;
}
public void setPriceBook(double price) {
this.price = price;
}
public double getPrice() {
return price;
}
public void setAuthor(String author) {
this.author = author;
}
public int getAuthor() {
return isbn;
}
public void setIsbn(int isbn) {
this.isbn = isbn;
}
public int getIsbn() {
return isbn;
}
}
著者クラス----------
public class Author{
private String auFname;
private String auSname;
private String auNational;
public Author (String auFname, String auSname, String auNational){
this.auFname = auFname;
this.auFname = auSname;
this.auNational = auNational;
}
public String getAuFname() {
return auFname;
}
public void setFirstName(String auFname) {
this.auFname = auFname;
}
public String getAuSname() {
return auSname;
}
public void setSecondName(String auSname) {
this.auSname = auSname;
}
public String getAuNational() {
return auNational;
}
public void setAuNational(String auNational) {
this.auNational = auNational;
}
}