




免费预览已结束,剩余1页可下载查看
下载本文档
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
class PersonString name;char sex;int age;float height;String native_place;String occupation;String marriage;float income;float month_income;public Person(String xingming, char xingbie, int nianling, float shengao, String jiguan, String zhiye, String hunfou, float shouru)name = xingming;sex = xingbie;age = nianling;height = shengao;native_place = jiguan;occupation = zhiye;marriage = hunfou;month_income = shouru;float get_income()income = month_income * 12.0f;return income;/王鹏,男,28岁,173cm,四川成都人,电子科技大学教师,未婚,月收入3000元。/李芳,女,26岁,高162cm,云南昆明人,成都邮政局职工,未婚,月收入2500元。/Test_Person.javapublic class Test_Personpublic static void main(String args)Person p1 = new Person(王鹏,男,28,173f,四川成都,电子科技大学教师,未婚,3000f);Person p2 = new Person(李芳,女,26,162f,云南昆明,成都邮政局职工,未婚,2500f);System.out.println(姓名:+);System.out.println(性别:+p1.sex);System.out.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(n);System.out.println(姓名:+);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_income();class PersonString name;char sex;int age;float height;String native_place;String occupation;String marriage; float weight; public Person(String xingming, char xingbie, int nianling, float shengao, String jiguan, String zhiye, String hunfou, float tizhong)name = xingming;sex = xingbie;age = nianling;height = shengao;native_place = jiguan;occupation = zhiye;marriage = hunfou;weight=tizhong; float normalize_weight(float height) float biaozhun_weight=0.0f; if(height=166&height175) biaozhun_weight=height-110; return biaozhun_weight; public class Test_Personpublic static void main(String args)Person p1 = new Person(欧明杰,男,20,173f,福建宁德,学生,未婚,100.0f);System.out.println(姓名:+);System.out.println(性别:+p1.sex);System.out.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.weight);System.out.println(标准体重:+p1.normalize_weight(p1.height);class Personprivate String name=unknown;private int age = -1;public Person()System.out.println(constructor1 is calling); public Person(String n) name = n; System.out.println(constructor2 is calling); public Person(String n,int a) name = n; age = a; System.out.println(constructor3 is calling); public String toString() String s=姓名 +name+t年龄 +age; return s; class TestPersonpublic static void main(String args)Person p1=new Person();System.out
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 2025年度专业农产品集市摊位租赁经营合同
- 2025年度汽车抵押融资平台服务协议
- 2025版国际贸易保险合同范本下载
- 分布式光伏与建筑一体化2025年市场推广挑战与技术突破创新路径研究报告
- 2025版教育培训机构信息服务合同范本
- 2025碧桂园物业用房施工与物业服务质量保证合同
- 2025年农业循环经济菜园大棚承包与资源利用合同
- 2025年度婚纱摄影作品居间代理服务合同
- 2025年度租赁合同样本(含特殊条款定制服务)
- 2025电梯品牌代理商授权与区域市场管理合同范本
- 2025云南文山州融资担保有限责任公司人员招聘6人笔试参考题库附答案解析
- 2025山西运城市临猗县招聘社区工作者32人(一)考试备考试题及答案解析
- 2025年鞍山市铁西区教育局面向师范类院校应届毕业生校园招聘45人笔试参考题库附答案解析
- 空调与制冷操作考试试题(含答案)
- (2025年)河南省信阳市辅警协警笔试笔试真题(含答案)
- 网络直播带货讲解
- 2025江西九江都昌县公安局招聘警务辅助人员14人笔试备考题库及答案解析
- 肿瘤药物配制注意事项
- GB/T 22126-2025物流中心作业通用规范
- 工管人才面试宝典:高级管理面试题目及答案解析
- 宿舍用水管理办法
评论
0/150
提交评论