




已阅读5页,还剩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年度智能sc健康监测设备区域总代理合作协议
- 2025年重型货车购置合同附带全天候道路救援服务条款
- 2025年资阳市中考化学试题卷
- 2025年城市污水处理厂设备升级改造项目合同样本
- 2025年专业餐饮食材配送服务采购协议书
- 网红美食体验店全年战略合作框架协议
- 2026创新设计高考总复习生物(人教版)-限时强化练答案解析
- 2025年中学生法治素养竞赛题库及答案
- 益阳市融资担保有限责任公司招聘考试真题2024
- 新人教版五年级上册小学数学教学计划+教学进度表
- 痔疮的健康教育课件
- 优甲乐(左甲状腺素钠片)健康教育
- 肝脏弥漫性病变超声诊断与检查规范
- 2025年长沙市中考物理试卷真题(含答案)
- 建筑工地驻场人员管理办法及流程
- 2025年全国工会系统经审业务技能大赛知识总题库(1800题)-中部分
- 心脏骤停的急救及处理
评论
0/150
提交评论