如何开始这个项目
How to get started on this project?
我很难理解我的项目说明,英语是我的第二语言,所以有人能帮助我分解它并帮助我如何进行这个项目吗?
项目摘要
编写一个为棒球队生成统计数据的程序。
说明:
创建BaseballStats类:
它有两个实例变量:
teamName,字符串
battingAverages,一组双打,代表球队中所有球员的平均打击率。
该类具有以下API:
构造函数:
public BaseballStats( String filename )
球队名称和球队的打击率存储在文件中。你可以假设文件中的第一项是球队名称(一个单词——没有空格),后面紧跟着正好20个打击率。构造函数应该将文件读取到teamName实例变量和battingAverages数组中。
方法:
public String getTeamName( )
accessor for teamName
public void setTeamName( String newTeamName )
mutator for teamName
public double maxAverage( )
returns the highest batting average
public double minAverage( )
returns the lowest batting average
public double spread( )
returns the difference between the highest and lowest batting averages
public int goodPlayers( )
returns the number of players with an average higher than .300
public String toString( )
returns a String containing the team name followed by all the batting averages formatted to three decimal places.
客户端类别:
您的客户端应该实例化BaseballStats类的一个对象,传递包含团队名称和平均值的文本文件的名称。然后,客户端应该调用所有方法,并将结果报告为输出。
根据您的评论判断,您可能从未使用过Java。以下是它应该如何布局:
class BaseballStats {
private String filename;
public BaseballStats ( String filename )
{
this.filename = filename;
}
public String getTeamName( )
{
//accessor for teamName
}
public void setTeamName( String newTeamName )
{
//mutator for teamName
}
public double maxAverage( )
{
//returns the highest batting average
}
public double minAverage( )
{
//returns the lowest batting average
}
public double spread( )
{
//returns the difference between the highest and lowest batting averages
}
public int goodPlayers( )
{
//returns the number of players with an average higher than .300
}
public String toString( )
{
//returns a String containing the team name followed by all the batting averages formatted to three decimal places.
}
}
您的客户端(同一目录中的另一个java文件)可以使用创建此类的实例
BaseballStats newTeam = new BaseballStats(filename);
相关文章:
- 正在将数据主题添加到所有项目
- 动态地改变“”的URL;添加新项目”;链接使用javascript/jquery
- 如何检查管道中未定义的项目
- 有没有一种方法可以添加相同的项目val=“0”;4〃;到JavaScript中数组的每个对象
- 学生搜索项目jquery/javascript
- 如何开始这个项目
- 在JQuery中,'加载'方法'的相对路径在引用项目中的html文件时开始
- react.js每n个项目添加一个开始标签或结束标签
- 如何使项目在开始另一个过渡之前完成一个过渡
- 通用控件替换项目 - 如何开始
- 下载开始时隐藏项目
- 剑道可拖动:拖动开始后更改拖动项目
- 从数组(切片)中提取x个项目,但如果到达末尾,则从头开始继续
- 我正在开始一个离子项目,但它只给出了一个白色的屏幕.没有显示错误
- 开始处理大型项目
- For循环jQuery,在4个项目后重新开始
- GWT:是否有可能先使用GWT开始项目,然后最终迁移到完整的javascript ?
- Angular - ngAnimate - Animate.项目首先显示,然后动画开始
- 当滑块开始更改项目时,添加分页活动类
- 如何在页面加载的第一个项目之后开始旋转木马