今天完成了昨天的代码
是一个十分简单的类的应用
很难基础的知识
在此附上代码和运行截图
package a20200719;
public class book {
private String BookName;
private String author;
private String press;
private long Bbooktime;
private long Rbooktime;
private long SRbooktime;
private long overlap;
private long fine;
public book(String BN,String au,String pr,long Bb,long Rb,long SR,long ov,long fi) {
this.author=au;
this.Bbooktime=Bb;
this.BookName=BN;
this.fine=fi;
this.overlap=ov;
this.press=pr;
this.Rbooktime=Rb;
this.SRbooktime=SR;
}
public void SetBookName(String a) {
this.BookName = a;
}
public void Setauthor(String a) {
this.author = a;
}
public void Setpress(String a) {
this.press = a;
}
public String getBookName() {
return BookName;
}
public String getpress() {
return press;
}
public String getauthor() {
return author;
}
public void SetBbooktime(long a) {
this.Bbooktime = a;
}
public void SetRbooktime(long a) {
this.Rbooktime = a;
}
public void SetSRbooktime(long a) {
this.SRbooktime = a;
}
public void Setoverlap(long a) {
this.overlap = a;
}
public void Setfine(long a) {
this.fine = a;
}
public long getBbooktime() {
return Bbooktime;
}
public long getRbooktime() {
return Rbooktime;
}
public long getSRbooktime() {
return SRbooktime;
}
public long overlap() {
return overlap;
}
public long fine() {
return fine;
}
public void show() {
System.out.println(BookName+" "+author+" "+press+" "+Bbooktime+" "+Rbooktime+" "+SRbooktime+" "+overlap+" "+fine);
}
}
private String BookName;
private String author;
private String press;
private long Bbooktime;
private long Rbooktime;
private long SRbooktime;
private long overlap;
private long fine;
public book(String BN,String au,String pr,long Bb,long Rb,long SR,long ov,long fi) {
this.author=au;
this.Bbooktime=Bb;
this.BookName=BN;
this.fine=fi;
this.overlap=ov;
this.press=pr;
this.Rbooktime=Rb;
this.SRbooktime=SR;
}
public void SetBookName(String a) {
this.BookName = a;
}
public void Setauthor(String a) {
this.author = a;
}
public void Setpress(String a) {
this.press = a;
}
public String getBookName() {
return BookName;
}
public String getpress() {
return press;
}
public String getauthor() {
return author;
}
public void SetBbooktime(long a) {
this.Bbooktime = a;
}
public void SetRbooktime(long a) {
this.Rbooktime = a;
}
public void SetSRbooktime(long a) {
this.SRbooktime = a;
}
public void Setoverlap(long a) {
this.overlap = a;
}
public void Setfine(long a) {
this.fine = a;
}
public long getBbooktime() {
return Bbooktime;
}
public long getRbooktime() {
return Rbooktime;
}
public long getSRbooktime() {
return SRbooktime;
}
public long overlap() {
return overlap;
}
public long fine() {
return fine;
}
public void show() {
System.out.println(BookName+" "+author+" "+press+" "+Bbooktime+" "+Rbooktime+" "+SRbooktime+" "+overlap+" "+fine);
}
}
package a20200719;
import a20200719.book;
public class bookmain {
public static void main(String[] arg) {
book A1 = new book("JAVA","WZY","QHDX",20200717,20200719,20200718,1,100);
book A2 = new book("a","b","c",0203,0205,0204,1,100);
book[] A = {A1,A2};
for(int i=0;i<A.length;i++) {
A[i].show();
}
}
}
import a20200719.book;
public class bookmain {
public static void main(String[] arg) {
book A1 = new book("JAVA","WZY","QHDX",20200717,20200719,20200718,1,100);
book A2 = new book("a","b","c",0203,0205,0204,1,100);
book[] A = {A1,A2};
for(int i=0;i<A.length;i++) {
A[i].show();
}
}
}