JAVA程序设计期末考试题.docxVIP

  • 1
  • 0
  • 约1.3千字
  • 约 3页
  • 2026-07-20 发布于四川
  • 举报

JAVA程序设计期末考试题

五、编程题(共29分)

1.(12分)设计一个简单的“学生信息管理”程序,要求如下:

定义一个`Student`类,包含私有属性:学号(`id`,String类型)、姓名(`name`,String类型)、年龄(`age`,int类型)、成绩(`score`,double类型)。

为`Student`类提供带参数的构造方法,以及所有属性的getter和setter方法。

定义一个`StudentManager`类,包含一个`ListStudent`类型的成员变量用于存储学生信息。

在`StudentManager`类中实现以下方法:

`addStudent(Studentstudent)`:添加学生到列表中。

`searchStudentById(Stringid)`:根据学号查找学生,返回找到的学生对象,若未找到返回`null`。

`printAllStudents()`:遍历列表,打印所有学生的完整信息(格式自定,清晰即可)。

2.(17分)编写一个Java程序,实现一个简单的“图书借阅系统”的部分功能。具体要求如下:

定义一个`Book`类,包含属性:图书编号(`bookId`,String类型)、书名(`title`,String类型)、作者(`author`,String类型)、是否可借(`isBorrowed`,boolean

文档评论(0)

1亿VIP精品文档

相关文档