package cn.sg.demo01;
/**
* 对数据进行封装,定义空参,有参方法
*
* @author Administrator
*
*/
public class Details {
private char sex;
private String knowledge;
private int number;
private String name;
private int age;
private String Looks;//外貌
private double height;//身高
private double bust;//胸围
private double waist;//腰围
private double hipline;//臀围
public Details(char sex, String knowledge, int number, String name, int age, String looks, double height) {
super();
this.sex = sex;
this.knowledge = knowledge;
this.number = number;
this.name = name;
this.age = age;
Looks = looks;
this.height = height;
}
public Details() {
super();
}
public Details(int number, String name, int age, String looks, double height, double bust, double waist,
double hipline) {
super();
this.number = number;
this.name = name;
this.age = age;
Looks = looks;
this.height = height;
this.bust = bust;
this.waist = waist;
this.hipline = hipline;
}
public int getNumber() {
return number;
}
public void setNumber(int number) {
this.number = number;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public int getAge() {
return age;
}
public void setAge(int age) {
this.age = age;
}
public String getLooks() {
return Looks;
}
public void setLooks(String looks) {
Looks = looks;
}
public double getHeight() {
return height;
}
public void setHeight(double height) {
this.height = height;
}
public double getBust() {
return bust;
}
public void setBust(double bust) {
this.bust = bust;
}
public double getWaist() {
return waist;
}
public void setWaist(double waist) {
this.waist = waist;
}
public double getHipline() {
return hipline;
}
public void setHipline(double hipline) {
this.hipline = hipline;
}
public char getSex() {
return sex;
}
public void setSex(char sex) {
this.sex = sex;
}
public String getKnowledge() {
return knowledge;
}
public void setKnowledge(String knowledge) {
this.knowledge = knowledge;
}
@Override
public String toString() {
return "Details [number=" + number + ", name=" + name + ", age=" + age + ", Looks=" + Looks + ", height="
+ height + ", bust=" + bust + ", waist=" + waist + ", hipline=" + hipline + "]";
}//打印
//构造方法:
public void ChooseClerk(String address,int people) {
System.out.println("新入职员工李春华家庭住址:"+address+"\t家中有:"+people+"口人");
}
}
package cn.sg.demo01;
/**
* 模特大赛
*
* @author Administrator
*
*/
public class ModelMatch {
public static void main(String[] args) {
Details details = new Details();
details.setNumber(1);
details.setName("小莉莉");
details.setAge(23);
details.setHeight(172);
details.setLooks("91分,优秀");
details.setBust(90.1);
details.setWaist(59.5);
details.setHipline(88.5);
System.out.println(details.getNumber()+"号选手\t"+details.getName()+"\t"+"芳龄:"+details.getAge()
+"\t身高:"+details.getHeight()+"\t举止表现:"+details.getLooks()+"\t三围:"+details.getBust()+"\t"+details.getWaist()+"\t"+details.getHipline());
Details details2 = new Details();
details2.setNumber(2);
details2.setName("小蜜蜜");
details2.setAge(21);
details2.setHeight(178);
details2.setLooks("94分,优秀");
details2.setBust(87.9);
details2.setWaist(60.1);
details2.setHipline(86.3);
System.out.println(details2.getNumber()+"号选手\t"+details2.getName()+"\t"+"芳龄:"+details2.getAge()
+"\t身高:"+details2.getHeight()+"\t举止表现:"+details2.getLooks()+"\t三围:"+details2.getBust()+"\t"+details2.getWaist()+"\t"+details2.getHipline());
Details details3 = new Details(3, "小西西", 18, "92分,优秀", 170, 98.3, 57.1,
60.9) ;
System.out.println(details3);
System.out.println("经评委评选,去掉一个最低分一个最高分,最后的优胜者是:3号选手");
}
}
package cn.sg.demo01;
public class ChooseClerk {
public static void main(String[] args) {
String address;
int people;
Details details = new Details();
details.setAge(28);
details.setKnowledge("精通Java");
details.setLooks("良好");
details.setName("张大牛");
details.setNumber(01);
details.setSex('男');
details.setHeight(180);
System.out.println("号数:"+details.getNumber()+"\t姓名:"+details.getName()+"\t年龄:"+details.getAge()+"\t身高:\t"+details.getHeight()
+"\t举止表现:"+details.getLooks()+"\t\t技能:"+details.getKnowledge());
Details details2 = new Details();
details2.setAge(21);
details2.setKnowledge("精通Java与运维");
details2.setLooks("优秀");
details2.setName("李春华");
details2.setNumber(02);
details2.setSex('男');
details2.setHeight(195);
System.out.println("号数:"+details2.getNumber()+"\t姓名:"+details2.getName()+"\t年龄:"+details2.getAge()+"\t身高:\t"+details2.getHeight()
+"\t举止表现:"+details2.getLooks()+"\t\t技能:"+details2.getKnowledge());
System.out.println("经公司议论,得最终李春华可以进入我公司工作\n");
details2.ChooseClerk("平安省平安市平安县平安镇平安村", 4);
}
}
运行程序: