
正文
java的行星代码 java staric
提示:扫一扫查出行【扫一扫了解最新限行尾号】
复制提示
编写java程序打印金字塔形图案。
public
class
Main
{
public
static
void
main(String[]
args)
{
for
(int
i
=
0;
i
5;
i++)
//这一句控制5行的打印。
{
for
(int
j
=
0;
j
5
-
i
-
1;
j++)
{
System.out.print("
");
}//这一句共执行 5-i-1次,即输出 5-i-1个空格。
for
(int
k
=
0;
k
2*i+1;
k++)
{
System.out.print("*");
}//这一句共执行 i+1次。即输出2i+1个*。
//该输出的都输出了,换一行继续打印。
System.out.println();
//打印一个回车符,即换行了。
}//你可以迭代一下每个i值,看看打印的个数对不对。
}
}下边是我写的其他程序。
相关问答
Q1: IBM为什么将他的Java开发平台命名为Eclipse(日食)?和Sun公司有关系吗?
其实这个嘛java的行星代码,说起来也还是有点渊源java的行星代码的。
搞软件java的行星代码的人大概都知道现在软件行业做大的有3巨头!微软、IBM、和SUN公司。
所以就不可避免的存在一些竞争java的行星代码,因此把自己的东西命名为和对手有一定关系,还是可以理解的!eclipse的意思就是使什么暗淡无光,也包含有一些打败sun公司的意思!
Q2: java的程序问题2
In this exercise, we will use the Math and Random class to manipulate values for a specific problem.
在这个练习中,我们将用数学和Random class去解决和调控值的有关的特定问题。
A recent research conducted has concluded that the likelihood of a planet in an extra-solar planetary system containing water in its atmosphere can be estimated by the following formula:
一个最近完成的研究得出了这样的结论:在太阳系外某个系统中的某个星球的大气层含有水的可能性可以通过下面的公式来估计:
Likelihood = (rand * planetmass ) / sunmass
可能性=(随机数*行星质量)/恒星质量
The input to the program is the mass of the planet, and the mass of its parent sun. rand is a random
number generated between 0.5 and 0.6.
所要输入到程序里的有行星的质量以及它所围绕着的恒星的质量。Rand指的是介于0.5和0.6之间的一个随机数。
Write a Java program to calculate and report the likelihood of the presence of water.
编写一个Java程序去计算并报道出有水的可能性。
Exercise 5 [5 marks]
Typically, books are identified by an International Standard Book Number (ISBN) which adheres to a specific format, e.g. 0-393-30375-6.
很典型的一件事是所有书都拥有能识别它们自己的ISBN号,也就是国际标准图书编号,比如说0-393-30375-6,而ISBN号和一个具体公式有关系
The first digit indicates the language in which the book is
written. The next group of digits specifies the publisher and the group after that is a number assigned by the publisher to identify the book. The ISBN ends with a “check digit” that is used to verify the accuracy of the preceding digits.
第一个数字代表了该书的语言体系。下一组数字指定出了出版商,再接下来的一组是由出版商指定用来识别此书的。ISBN号以“检验数字”结束的,这个数字是用来核实前面所有数字的准确性的。
Write a program that breaks down an ISBN entered by the user as follows:
如下编写一个能够肢解用户输入的ISBN号的程序:
Please enter the ISBN number in the following format x-xxx-xxxxx-x: 0-123- 45678-9
按照 x-xxx-xxxxx-x的格式输入ISBN号:0-123- 45678-9
Language = 0
语言=0
Publisher = 123
出版商=123
Book = 45678
出版商识别的该书:45678
Check = 9
检验数字=9
FIT1002 Computer Programming Prac 3/Week 4 – Introduction to Classes and Objects
Developed by the FIT1002 Multi-campus Unit Management Group, 2008 Page 3 of 3
Faculty of Information Technology, Monash University
(略)
Hint: You will need to read in the input as a String and then use the method available in the
Scanner class called useDelimiter("-") to break down the ISBN. Please refer to the Scanner
class documentation available in the Javadocs.
提示:你将需要把所输入的东西作为一个变量并且用Scanner class中可行的useDelimiter("-")办法去肢解ISBN号。请参考java语言书籍中的有关Scanner class的文件。
Test your understanding
测试一下你的理解程度。
Attempt the Quiz on the MUSO course web site
试着参加MUSO课程网站上的小考。
java的行星代码的介绍就聊到这里吧,感谢你花时间阅读本站内容,更多关于java staric、java的行星代码的信息别忘了在本站进行查找喔。







