资源描述:
《简单java程序》由会员上传分享,免费在线阅读,更多相关内容在工程资料-天天文库。
1、技术资料classPerson{Stringname;charsex;intage;floatheight;Stringnative_place;Stringoccupation;Stringmarriage;floatincome;floatmonth_income;publicPerson(Stringxingming,charxingbie,intnianling,floatshengao,Stringjiguan,Stringzhiye,Stringhunfou,floatshouru){name=xingming;sex=xing
2、bie;age=nianling;height=shengao;native_place=jiguan;occupation=zhiye;marriage=hunfou;month_income=shouru;}floatget_income(){income=month_income*12.0f;returnincome;}}//王鹏,男,28岁,173cm,四川成都人,电子科技大学教师,未婚,月收入3000元。共享知识技术资料//李芳,女,26岁,高162cm,云南昆明人,成都邮政局职工,未婚,月收入2500元。//Test_Perso
3、n.javapublicclassTest_Person{publicstaticvoidmain(Stringargs[]){Personp1=newPerson("王鹏",'男',28,173f,"四川成都","电子科技大学教师","未婚",3000f);Personp2=newPerson("李芳",'女',26,162f,"云南昆明","成都邮政局职工","未婚",2500f);System.out.println("姓名:"+p1.name);System.out.println("性别:"+p1.sex);System.out.
4、println("年龄:"+p1.age);System.out.println("身高:"+p1.height);System.out.println("籍贯:"+p1.native_place);System.out.println("职业:"+p1.occupation);System.out.println("婚姻状况:"+p1.marriage);System.out.println("年收入:"+p1.get_income());System.out.println('');System.out.println("姓名:"+
5、p2.name);System.out.println("性别:"+p2.sex);System.out.println("年龄:"+p2.age);System.out.println("身高:"+p2.height);System.out.println("籍贯:"+p2.native_place);System.out.println("职业:"+p2.occupation);System.out.println("婚姻状况:"+p2.marriage);共享知识技术资料System.out.println("年收入:"+p2.get
6、_income());}}classPerson{Stringname;charsex;intage;floatheight;Stringnative_place;Stringoccupation;Stringmarriage;floatweight;publicPerson(Stringxingming,charxingbie,intnianling,floatshengao,Stringjiguan,Stringzhiye,Stringhunfou,floattizhong){name=xingming;sex=xingbie;age=
7、nianling;height=shengao;native_place=jiguan;occupation=zhiye;marriage=hunfou;共享知识技术资料weight=tizhong;}floatnormalize_weight(floatheight){floatbiaozhun_weight=0.0f;if(height<=165)biaozhun_weight=height-100;elseif(height>=166&height<=175)biaozhun_weight=height-105;elseif(heig
8、ht>175)biaozhun_weight=height-110;returnbiaozhun_weight;}}publicclassTest_Person{publicst