我被困在这个问题上,我有一门课叫书,另一门课叫作者
在图书类中,我有标题、作者、价格和 ISBN
在作者类中,我有名字、姓氏和国籍
问题是将作者类与书籍类联系起来......
测试类--------
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;
}
}