package com.hanqi.test;
public class jidongche {
private String chepaihao;//车牌号
private int speed;//速度
private double weight;//载重量
//无参构造方法
jidongche()
{
}
public String getChepaihao() {
return chepaihao;
}
public void setChepaihao(String chepaihao) {
this.chepaihao = chepaihao;
}
public int getSpeed() {
return speed;
}
public void setSpeed(int speed) {
this.speed = speed;
}
public double getWeight() {
return weight;
}
public void setWeight(double weight) {
this.weight = weight;
}
//有参构造方法
jidongche(String cph,int sp,double wh)
{
chepaihao=cph;
speed=sp;
weight=wh;
}
//设置成员方法
public int getAddspeed(int add)
{
return speed+=add;
}
public int getjianspeed(int jian)
{
return speed-=jian;
}
public void setchepaihap(String chage)
{
chepaihao=chage;
}
jidongche jdc=new jidongche();
jdc.setChepaihao("xx1234");
jdc.setSpeed();
jdc.setWeight();
System.out.println("无参构造方法车牌号为:"+jdc.getChepaihao()+"\r速度为:"+jdc.getSpeed()+"\r载重量为:"+jdc.getWeight());
jdc.setChepaihao("辽A9752");
jdc.getAddspeed();
System.out.println("无参构造方法将车牌号改为:"+jdc.getChepaihao()+"\r速度增加到:"+jdc.getSpeed());
jidongche jdc1=new jidongche("xx1234", , );
jdc1.getjianspeed();
jdc1.setchepaihap("辽B5086");
System.out.println("有参构造方法将车牌号改为:"+jdc1.getChepaihao()+"\r速度减为:"+jdc1.getSpeed());
System.out.println("该车辆的载重量为:"+jdc1.getWeight());
随机推荐
vue组件编译原理
com1ZOJ Problem Set - 3861 Valid Pattern Lock(dfs)
http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=3861 这道题当时没做出来,后来经过队友提醒才做出来. 3*3的九宫格,给你 ...
SQL Server 内存压力解决方案
外部压力: 表现形式: 1.total server memory ↓ 2.avilable Mbyte 平衡 3.working set ↓ 如果说SQ ...
swift类名称显示变量
zabbix 监控安装
注意:此篇是在安装好lnmp环境后才能部署的操作,所以,做之前准备好lnmp环境,或者可以参考我做的lnmp环境,之后接着此篇开始安装 监控系统Zabbix-3.2.1的安装 zabbix-serve ...
Alpha版本检测报告
1.Alpha版本测试报告 发布一篇随笔,作为项目的测试报告,内容包括: (1)测试计划 测试人员 工作安排 覃一霸 编写测试报告 张江波 执行测试.截图测试结果 测试功能 功能 描述 效果 结果 登 ...
239. [LeetCode ]Sliding Window Maximum
Given an array nums, there is a sliding window of size k which is moving from the very left of the a ...