import java.util.ArrayList;import java.util.List;import java.util.Scanner;publicclassMeiNv{publicstaticvoidmain(String[] args){/*ArrayList<Integer> highs=new ArrayList();
ArrayList<Integer> wights=new ArrayList();*/
Scanner scanner=newScanner(System.in);
List<Girl> girlList=newArrayList<>();for(int i=1;i<4;i++){
Girl girl=newGirl();
System.out.println("请输入第"+i+"个美女的身高:");
int h=scanner.nextInt();
girl.setHigh(h);/*highs.add(h);*/
System.out.println("请输入第"+i+"个美女的体重:");
int w=scanner.nextInt();
girl.setWigh(w);/*wights.add(w);*/
girlList.add(girl);}
System.out.println(girlList);/*highs.add(180);
highs.add(170);
highs.add(160);
wights.add(50);
wights.add(45);
wights.add(46);*/
int sumW=0;
int sumH=0;/*
for (int i=0;i<highs.size();i++){
sumH=sumH+highs.get(i);
sumW=sumW+wights.get(i);
}
*///增强for循环for(Girl g:girlList){
sumH=sumH+g.getHigh();
sumW=sumW+g.getWigh();}
System.out.println(sumH);
System.out.println(sumW);
int avgH=sumH/girlList.size();
int avgW=sumW/girlList.size();
System.out.println(avgH);
System.out.println(avgW);if(avgH>160& avgW<50){
System.out.println("是美女");}else{
System.out.println("不是美女");}}}
publicclassGirl{private int high;private int wigh;public int getHigh(){return high;}publicvoidsetHigh(int high){this.high = high;}public int getWigh(){return wigh;}publicvoidsetWigh(int wigh){this.wigh = wigh;}
@Override
public String toString(){return"Girl{"+"high="+ high +", wigh="+ wigh +'}';}}