的整数,我在学校的这个问题,我不知道如何下手。显示以相反的顺序
这里是指示:
写具有以下标题的方法以相反的顺序来显示的整数:
公共静态INT反向(INT数)
示例输出:
输入一个整数: 12345(相反顺序)是54321
注:
您将需要...
- 找到整数
- 的长度提取每个数字
- 倘预期产出不匹配的输出测试或代码是不完整的,程序运行失败,积分将给予该代码正确写入
的部分~~~~~~~~~~~~~~~~~~~~ ~~~~~
这里是他们给我的骨架一起工作:
import java.util.Scanner;
public class ReverseNumber {
public static int reverse (int number) {
// FIXME 1 (50 points): Complete the method to return the number in reversed order
}
public static void main (String[] args) {
// FIXME 2 (25 points): Write the statements to prompt the user enter an integer and store it in an integer variable
System.out.println("Enter an integer: ");
/*
FIXME 3 (25 points): Write the statements to call the reverse (int number) method
Print the result in the required format
*/
System.out.println("12345 in reverse order is 54321");
}
}
我需要知道要放什么东西在这里把它放在哪里才能得到它输出一些东西一样的例子。不要更改框架,只需添加它即可。
http://stackoverflow.com/questions/3806126/java-reverse-int-value – Reimeus
欢迎堆栈溢出!看起来你正在寻求作业帮助。虽然我们本身没有任何问题,但请注意这些[注意事项](http://meta.stackoverflow。(334822/how-do-i-ask-and-answer-homework-questions/338845#338845),并相应地编辑你的问题。 –