y=-1+2x(x<0) =-1(x=0) =-1+3x(x>0) 输入x 输出y
import java.util.*;
public class getY
{
public static void main(String args[]){
Scanner reader=new Scanner(System.in);
double x=reader.nextDouble();
double y;
if(x<0)y=-1+2*x;
else if(x==0)y=-1;
else y=-1+3*x;
System.out.printf("y的值为:"+y);
}
}