1. Abstract the business class in the scenario of "Nantong Jade Bird IT Education Class 103 classmates taking Mr. Cui's Java class in classroom 3", the class contains attributes and methods, and write a blog post;
Use object-oriented thinking logic to analyze, abstract entities:
Class: Class 103
students: students
Classroom: 3 classrooms
Teacher: Teacher Cui
Course: java class
School: Nantong Jade Bird IT Education
packagehomework;
importjava.util.Date;
/**
* Student class
* @authorpc
*
*/
publicclass Student1 {
// member variable
String name ; // student name
int age ; // age
String clazz ; // class
String address ; // Student address
String course ; // course
String room ; // Classroom
String teacher ; // teacher
String school = " Nantong Jade Bird IT Education " ;
publicchar [] intro ;
// method
String intro() {
returnthis.course +"由" + this.teacher + "负责!";
}
void listen () {
System.out.println(school + this.clazz +this.name + "在" + this.room + "上" + this.teacher + "的" + this.course + "!");
}
// constructor method
Student1(String name, intage, String clazz, String address, Stringcourse, String room, String teacher){
this.name = name;
this.age = age;
this.clazz = clazz;
this.address = address;
this.course = course;
this.room = room;
this.teacher = teacher;
//System.out.println("wesd");
}
Student1(String name, intage){
this.name = name;
this.age = age;
}
}
packagehomework;
publicclass Customer2 {
publicstaticvoid main(String[] args) {
// Build an object and call the class's constructor
Student1 stu = new Student1( "Tom" ,25, "Java103 Class " , "" , "Java Basic Class " , " Class 3 " , " Mr. Cui " );
//System.out.println(stu.intro());
Student1 stu1 = new Student1( " Zhang Hongwei " ,25);
System.out.println(stu.intro());
stu.listen();
//stu1.listen();
}
}