9.23学习总结
(1)今日安排
病人信息管理及遍历
(2)源代码
Patient类:
public class Patient { String name; char sex; Integer age; float weight; boolean allergies; public void setName(String name) { this.name=name; } public String getName() { return name; } public void setSex(char sex) { this.sex=sex; } public char getSex() { return sex; } public void setAge(Integer age) { this.age=age; } public Integer getAge() { return age; } public void setWeight(float weight) { this.weight=weight; } public float getWeight() { return weight; } public void setAllergies(boolean allergies) { this.allergies=allergies; } public boolean getAllergies() { return allergies; } } }
text类:
public class text { public static void main(String[] args) { Patient ll = new Patient(); Patient hh = new Patient(); ll.setName("Lil Ghost"); ll.setSex('f'); ll.setAge(22); ll.setWeight(117); ll.setAllergies(false); hh.setName("Justin"); hh.setSex('f'); hh.setAge(19); hh.setWeight(120); hh.setAllergies(true); System.out.println("Name: "+ll.getName()+"\t"+hh.getName()); System.out.println("Sex: "+ll.getSex()+"\t\t"+hh.getSex()); System.out.println("Age: "+ll.getAge()+"\t\t"+hh.getAge()); System.out.println("Weight: "+ll.getWeight()+"\t"+hh.getWeight()); System.out.println("Allergies: "+ll.getAllergies()+"\t"+hh.getAllergies()); } }