急急急!!!JAVA---请java高手帮帮忙!!
java编程:设计一个动物类,它包含动物的基本属性,例如名称、身长、质量等,并设计相应的动作,例如,跑、跳、走等等。随便一种动物都行。程序编得越简单越好。请高手们帮帮我,...
java编程:设计一个动物类,它包含动物的基本属性,例如名称、身长、质量等,并设计相应的动作,例如,跑、跳、走等等。
随便一种动物都行。程序编得越简单越好。
请高手们帮帮我,有额外奖励的哦。 展开
随便一种动物都行。程序编得越简单越好。
请高手们帮帮我,有额外奖励的哦。 展开
5个回答
展开全部
package 实验;
public class Animal
{
private String name;
private double height;
private double weight;
public Animal(String name,double height,double weight)
{
this.name=name;
this.height=height;
this.weight=weight;
}
public void run()
{
System.out.println(this.name+"跑起来了.");
}
public void jump()
{
System.out.println("哈哈,快看,"+this.name+"跳的好高啊!");
}
public void zou()
{
System.out.println("走啊-走啊-走啊走.");
}
}
public class Animal
{
private String name;
private double height;
private double weight;
public Animal(String name,double height,double weight)
{
this.name=name;
this.height=height;
this.weight=weight;
}
public void run()
{
System.out.println(this.name+"跑起来了.");
}
public void jump()
{
System.out.println("哈哈,快看,"+this.name+"跳的好高啊!");
}
public void zou()
{
System.out.println("走啊-走啊-走啊走.");
}
}
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
public class Animal {
private String name;
private String height;
private String weight;
/**
* @return the height
*/
public String getHeight() {
return height;
}
/**
* @param height
* the height to set
*/
public void setHeight(String height) {
this.height = height;
}
/**
* @return the name
*/
public String getName() {
return name;
}
/**
* @param name
* the name to set
*/
public void setName(String name) {
this.name = name;
}
/**
* @return the weight
*/
public String getWeight() {
return weight;
}
/**
* @param weight
* the weight to set
*/
public void setWeight(String weight) {
this.weight = weight;
}
public void run(){
System.out.println("跑");
}
public void jump(){
System.out.println("跳");
}
public void walk(){
System.out.println("走");
}
}
private String name;
private String height;
private String weight;
/**
* @return the height
*/
public String getHeight() {
return height;
}
/**
* @param height
* the height to set
*/
public void setHeight(String height) {
this.height = height;
}
/**
* @return the name
*/
public String getName() {
return name;
}
/**
* @param name
* the name to set
*/
public void setName(String name) {
this.name = name;
}
/**
* @return the weight
*/
public String getWeight() {
return weight;
}
/**
* @param weight
* the weight to set
*/
public void setWeight(String weight) {
this.weight = weight;
}
public void run(){
System.out.println("跑");
}
public void jump(){
System.out.println("跳");
}
public void walk(){
System.out.println("走");
}
}
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
。。。。。还是自己写吧
这是最最基础的OO思想啊~~
这是最最基础的OO思想啊~~
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
2009-09-27
展开全部
public class Animal{
String name;
float height;
float weight;
public void run(){}
public void jump(){}
public void walk(){}
}
String name;
float height;
float weight;
public void run(){}
public void jump(){}
public void walk(){}
}
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
不用高手的
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询