写一个基于java的医药管理系统的代码
时间: 2023-03-14 19:20:26 浏览: 195
我们可以使用 Java 语言来开发一个基于 Java 的医药管理系统,以下是它的代码:public class MedicalSystem {
// 声明类变量
private String patientName;
private String patientId;
private String patientAge;
private String patientGender;
private String patientPhone;
private String patientAddress;
private String medicineName;
private int medicineQuantity;
private String medicineType;
// 声明类方法
public void setPatientInfo(String name, String id, String age, String gender, String phone, String address) {
patientName = name;
patientId = id;
patientAge = age;
patientGender = gender;
patientPhone = phone;
patientAddress = address;
}
public void setMedicineInfo(String name, int quantity, String type) {
medicineName = name;
medicineQuantity = quantity;
medicineType = type;
}
public void printPatientInfo() {
System.out.println("Patient Name:" + patientName);
System.out.println("Patient ID:" + patientId);
System.out.println("Patient Age:" + patientAge);
System.out.println("Patient Gender:" + patientGender);
System.out.println("Patient Phone:" + patientPhone);
System.out.println("Patient Address:" + patientAddress);
}
public void printMedicineInfo() {
System.out.println("Medicine Name:" + medicineName);
System.out.println("Medicine Quantity:" + medicineQuantity);
System.out.println("Medicine Type:" + medicineType);
}
}
阅读全文