0
Pass and fail problem
Problem: If my input is 1 70, then it should say pass, if my input is 1 60 its should say fail... Right now, it says pass when i type in 1 70 70, but it should only ask for 1 70, not 2 70's, UNLESS my first int is 2, then it should ask for 2 70's Errors: it gives me an error if my 1 doesnt have 2 following integers, it should only have 1. it gives me sn error whenever i start with 2, no matter the amount of integers afterwards. I have been struggeling with this code for over 2 days now, and i just cant seem to get it working, no matter how i change the code... Here is my code: https://code.sololearn.com/c3LMJKHQ9VOh/?ref=app
6 odpowiedzi
0
hi Stephen,
i have improve your code to the fast.
it run without error
look for scanner methods hasNext... and next... and their description
https://code.sololearn.com/cOnY1bU2f0Sy
0
asa22 Thank you so much! This was really helpful!
0
asa22, the code has a problem, and i dont understand why, whenever i type in:
1 70 (or more than 70)
The the output if 'fail', but then i put in anything less than 70, it says 'no output'
0
asa22, the code has a problem, and i dont understand why, whenever i type in:
1 70 (or more than 70)
The the output is 'fail', but then i put in anything less than 70, it says 'no output'
0
sorry, i don’t get a message about your post.
i use a linebreak for the input data
i ask explicit
if (numbs.hasNextLine()) {
numbs.nextLine();
input : 1 return 70 return .....
if you want to input the data in one line,
you have to change the program, with this.....
Scanner scanner = new Scanner(System.in);
while(scanner.hasNext())
{
System.out.println(scanner.nextInt());
}
0
input in one line
https://code.sololearn.com/c3GMxcw9mINv