I am not understanding why my solution isn't passing the 'If the entered number is negative, increase it by one and display the result.' test. When i input a negative number and run my code it outputs the correct answer e.g -10 outputs -9 but i can't pass the tests? Any hints for this would be appreciated.
package en.codegym.task.jdk13.task04.task0412;
import java.io.BufferedReader;
import java.io.InputStreamReader;
/*
Positive and negative numbers
*/
// public class Solution {
// public static void main(String[] args) throws Exception {
// BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
// int number = Integer.parseInt(reader.readLine());
// if (number > 0) {
// number = number * 2;
// } else if (number < 0) {
// number = number + 1;
// }
// System.out.println(number);
// }
// }
public class Solution {
public static void main(String[] args) throws Exception {
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
String str = reader.readLine();
int number = Integer.parseInt(str);
if (number < 0){
System.out.println(number = number + 1);
}
if (number > 0){
System.out.println(number = number * 2);
}
else if (number == 0){
System.out.println("0");
}}}