java
// 患者信息类
public class Patient {
private String name;
private int age;
public Patient(String name, int age) {
this.name = name;
this.age = age;
}
public String getName() {
return name;
}
public int getAge() {
return age;
}
}
// 病历管理系统类
public class MedicalRecordSystem {
private List patients;
public MedicalRecordSystem() {
this.patients = new ArrayList<>();
}
public void addPatient(Patient patient) {
patients.add(patient);
}
public Patient findPatient(String name) {
for (Patient patient : patients) {
if (patient.getName().equals(name)) {
return patient;
}
}
return null;
}
}
顶一下
(0)
0%
踩一下
(0)
0%
- 相关评论
- 我要评论
-
上一篇:返回栏目
下一篇:java连接redis配置