皮皮学,免费搜题
登录
搜题
【简答题】
程序填空题2:继承与多态 。 项目描述:在学校管理系统中,有三种用户,系统管理员、学生和教师,编写Java类实现该继承关系。系统管理员/学生/教师用户名和密码属性,并Login和显示自身信息的方法,另外,学生拥有班级属性,教师拥有部门属性,系统管理员可以添加学生和教师信息。由于教师和学生个人信息不同,所以学生和教师重写基类的DisplayInfo方法。 请将程序补充完整,实现相应功能。 //1、父类User的定义 class User { String userName;// 用户名 String password;// 密码 int userType;// 用户类型:1代表学生,2代表教师,3代表管理员 User(String userName, String password) { this.userName = userName; this.password = password; } public void Login() { if (userName.equals("123") && password.equals("123")) { System.out.println("登录成功!"); } else { System.out.println("登录失败!"); } } public void DisplayPersonInfo() { System.out.println("姓名:" + userName); System.out.println("用户类型:" + userType); } } //2、子类student、teacher的定义 ___________ Student ___________ User { String classID; Student(String userName, String password, String classID) { ___________ (userName, password); super.userType = ___________;//1代表学生 ___________ .classID = classID; } public void DisplayPersonInfo() { ______________.DisplayPersonInfo(); System.out.println("班级:" + this.classID); } } class Teacher extends User{ String department; public Teacher(String userName, String password, String department) { super(userName, password); super.userType = 2;//2代表教师 this.department = department; } public void DisplayPersonInfo() { super.DisplayPersonInfo(); System.out.println("部门:" + this.department); } } //3、子类Sysmanager的定义 class SysManager extends User{ public SysManager(String userName, String password) { super(userName, password); super.userType = 3; //3代表管理员 } //插入学生方法,这里仅仅是模拟,现实中,要插入到数据库中。 public void InsertStudent(Student s) { ____________.DisplayPersonInfo(); } public void InsertTeacher (Teacher t) { t.DisplayPersonInfo(); } } public class TestUser { public static void main(String[] args) { Student s=____________ Student("123","123", "310163"); ___________.DisplayPersonInfo(); s.Login(); Teacher t = new Teacher("", "123", "计通院"); t.DisplayPersonInfo(); t.Login(); SysManager admin=new SysManager("admin", "123"); admin.___________________(s); } }
拍照语音搜题,微信中搜索"皮皮学"使用
参考答案:
参考解析:
知识点:
.
..
皮皮学刷刷变学霸
举一反三
【单选题】酶分子中使底物转变为产物的基团称为(    )
A.
结合基团  
B.
催化基团  
C.
碱性基团  
D.
酸性基团  
E.
疏水基团
【单选题】He changed his name, ______ that nobody would find out what he had done before.
A.
having thought
B.
to think
C.
thinks
D.
thinking
【单选题】使底物转变为产物的基团称为
A.
结合基团
B.
催化基团
C.
碱性基团
D.
酸性基团
【简答题】将列管换热器做成多管程的目的是
【单选题】使底物转变为产物的基团称为
A.
结合基团
B.
催化基团
C.
碱性基团
D.
酸性基团
E.
必需基团
【简答题】短文填空。 My name is Kitty. I'm fond of dancing. I want to be a dancer. I dance for two hours every day. I need lots of e _1 to dance every day. I need to eat a lot, because it's easy for me to get tired ...
【单选题】Although she is an _________ talented dancer, she still practices several hours every day.
A.
rationally
B.
additionally
C.
traditionally
D.
exceptionally
【单选题】What is not right about the man and woman?
A.
They are husband and wife.
B.
They are having their honeymoon.
C.
They have been married for a long time.
D.
They are staying in a hotel.
【单选题】Every day I dream____a  beautiful girl ____ in a red coat. She was in fact my    first lover. [     ]
A.
of; dressing
B.
of; dressed
C.
in; dressing
D.
in, dressed
【单选题】Are you a dancer?
A.
Yes, he is.
B.
No, I am not a dancer. I am a musician.
C.
No, I am a dancer.
相关题目: