有大佬帮忙写下这个程序嘛,谢谢

有大佬帮忙写下这个程序嘛,谢谢


 

import java.io.*;

public class scan {
    public static void main(String[] args) throws IOException {

     int x,y;
       Scanner sc = new Scanner(System.in);

      x = sc.nextInt();

      if(x<0)

         y=2*x-1;

    else if(x>0)

      y = 3*x-1;

    else

      y=-1;
    
        System.out.println(y);

 

    }
}

 

做个判断就是,if语句。