| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 890 人关注过本帖
标题:哪位高手肯帮我看看这几题啊~!
只看楼主 加入收藏
ekinkm
Rank: 1
等 级:新手上路
帖 子:10
专家分:0
注 册:2004-6-13
收藏
 问题点数:0 回复次数:8 
哪位高手肯帮我看看这几题啊~!

[attach]423[/attach]

题目很简单~最好在~星期1之给于答案~谢谢了~要是有相关的代码也可以

搜索更多相关主题的帖子: 最好 
2004-07-02 12:42
Anstey
Rank: 1
等 级:新手上路
帖 子:94
专家分:0
注 册:2004-4-14
收藏
得分:0 

public class Vehicle{ private char type; private int number; private String time;

public Vehicle(char type,int number,String t){ this.type = type; this.number = number; time = t; }

public void setType(char c){ type = c; }

public char getType(){ return type; }

public String toString(){ String result = ""; result += "The type of the car is: "+type+",the number is: "+number+",enter time: "+time+"."; return result; } }// end of Vehicle class

public class TestCar{ public static void main(String[] args){ Vehicle v = new Vehicle('L', 324563, "07:32:43"); System.out.println(v); } } //end of TestCar class

// I am not sure if this is what you want, but i suspect so :P


Anstey. Cheers. I love CAPPUCCINO~~
2004-07-02 20:35
Anstey
Rank: 1
等 级:新手上路
帖 子:94
专家分:0
注 册:2004-4-14
收藏
得分:0 

public class ClassData { private String name; // you may need this as public private int number; // this as well

ClassData(String theName, int theNumber) { name = theName; number = theNumber; }

public String getName(){ return name; }

public int getNum(){ return number; } }//end of ClassData class

public class AllClass{ ClassData data[] = new ClassData[200]; int classCount = 0;

public void addClass(String theName, int theNumber) { data[classCount] = new ClassData(theName,theNumber); classCount++; }

public int getNumber(String className) { for(int i = 0; i<classCount; i++){ if(data[i].getName().equals(className)) // i am not sure if i can use the accessor method here return data[i].getNum();//also not sure if i can use either } return -1; } }//end of AllClass class

// maybe you can declear String className and int number as public then you dont need the accessor method // but this is kind of unusual i think...


Anstey. Cheers. I love CAPPUCCINO~~
2004-07-02 20:56
Anstey
Rank: 1
等 级:新手上路
帖 子:94
专家分:0
注 册:2004-4-14
收藏
得分:0 
本来是想做三的,可是你的题目我不太清楚什么意思: 窗口上会显示信息"TRUE" ?? 这个是用g.drawString()还是写在一个TextField里,还是直接System.out.print() ???还有可不可以在constructor method里加一个boolean b;用来判断是应该"写"true 还是"false"?

Anstey. Cheers. I love CAPPUCCINO~~
2004-07-02 21:04
tempnetbar
Rank: 2
等 级:新手上路
威 望:4
帖 子:582
专家分:4
注 册:2004-5-5
收藏
得分:0 
我帮另一个人都做完了,你可以问他要,QQ:11793485

相信勤能补拙! 喜欢用好用的就永远学不到有用的。
2004-07-03 06:57
jawen
Rank: 1
等 级:新手上路
帖 子:25
专家分:0
注 册:2004-7-26
收藏
得分:0 
Anstey

的第一題答案好像有問題哦?

2004-09-16 15:11
jawen
Rank: 1
等 级:新手上路
帖 子:25
专家分:0
注 册:2004-7-26
收藏
得分:0 

public class Vehicle{ private char type; private int number; private String time;

裏面的public 去掉就沒問題了

2004-09-16 15:19
Anstey
Rank: 1
等 级:新手上路
帖 子:94
专家分:0
注 册:2004-4-14
收藏
得分:0 

哇。几百年前的。。。

Vehicle.java 和 TestCar.java是两个不同的class 把他们分开存。我写在一起是因为是一道题目。。

sorry for the confusion...


Anstey. Cheers. I love CAPPUCCINO~~
2004-09-16 15:50
shanji
Rank: 1
等 级:新手上路
帖 子:93
专家分:0
注 册:2005-1-23
收藏
得分:0 
2005-04-05 20:37
快速回复:哪位高手肯帮我看看这几题啊~!
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.016004 second(s), 9 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved