要求:按照自己的理解,给出问题的定义,然后采用Java语言,给出规范标准的描述,并设计主类完成相关功能的显示
教材如何定义与描述
package ch09_12;
public class Teaching {
private String name;//教材名称
private String author;//作者
private String press;//出版社
private String date;//出版日期
public String GetName() {
String a = name;
return a;
}
public String GetAuthor() {
String b = author;
return b;
}
public String GetPress() {
String c = press;
return c;
}
public String GetDate() {
String d = date;
return d;
}
public Teaching(String name,String author,String press,String date) {
this.name = name;
this.author = author;
this.press = press;
this.date = date;
}
public void show() {
System.out.println("教材名称为:"+GetName());
System.out.println("作者为:"+GetAuthor());
System.out.println("出版社为:"+GetPress());
System.out.println("出版日期为:"+GetDate());
}
}
package ch09_12;
public class Test_Teaching {
public static void main(String[] args) {
Teaching t1;
t1 = new Teaching("概率论与数理统计","苏本堂","人民邮电出版社","2020年3月");
t1.show();
}
}