程序的目标是测试从键盘输入的整数值是否等于176。如果是,则打印“YES”(不带引号)。
import java.util.Scanner;
public class Lesson_11_Activity_One {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
System.out.println(" Please enter a number :");
int number = input.nextInt();
if(number == 176)
{
System.out.println("Yes");
}
}
}
输出显示:
Your code has been evaluated against a set of test data.
You had 4 out of 5 tests pass correctly.
Double check your results in drJava and if you can't see what's wrong,
don't hesitate to start a post on Piazza.
Test 1, Decimal input but not 48.729: Passed!
Test 2, Decimal input but not 48.729: Passed!
Test 3, Decimal input but not 48.729: Passed!
Test 4, Integer input but not 48.729: Passed!
不确定问题出在哪里。
最佳答案
作业要求您打印出不带引号的“YES”。在你的程序中,它只打印出"is",代码没有问题,问题是当它要求"is"时,你打印"is",只需将"is"更改为"is"
关于java - Edhesive 说我的程序未通过所有测试,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35641381/