需要帮助:计算机科学101 HW/JAVA

需要帮助:计算机科学101 HW/JAVA,java,javascript,netbeans,boolean,hypotenuse,Java,Javascript,Netbeans,Boolean,Hypotenuse,我在标题中为这个问题编写了代码,似乎遇到了一些问题。有人能给我一些关于我做错了什么的见解或建议吗。尤其是代码中的“if…else”部分 这是问题9。如果单击链接,将显示问题的打印输出。 这是我的密码: import java.util.*; public class Ch3Ex9 { /** * This method asks user for an x,y coordinates of a point, then returns the * distance to the origin

我在标题中为这个问题编写了代码,似乎遇到了一些问题。有人能给我一些关于我做错了什么的见解或建议吗。尤其是代码中的“if…else”部分

这是问题9。如果单击链接,将显示问题的打印输出。

这是我的密码:

import java.util.*;
public class Ch3Ex9 {
/**
 * This method asks user for an x,y coordinates of a point, then returns the
 * distance to the origin and which quadrant the point is in.
 */
public static void main(String[] args)
{
    double xCoord; //x Coordinant initialized to 3
    double yCoord; //y Coordinant initalized to 4
    double hypo; //hypotenuse

    //declare an instance of Scanner to read the datastream from the keyboard
    Scanner keyboard = new Scanner(System.in);

    //get x Coordinant from the user
    System.out.print("Please enter the X coordinant: ");
    xCoord = keyboard.nextDouble();

    //get Y Coordinate from the user
    System.out.print("Please enter the Y coordinant: ");
    yCoord = keyboard.nextDouble();

    //calculate the hypotenuse which is the length to the origin
    hypo = Math.hypot(xCoord, yCoord);
            System.out.println("The hypotenuse is "+hypo);

    //determine which Quadrant the user-inputted point resides in
    if (xCoord>0) && (yCoord>0) //
        System.out.println("Point lies in Quadrant I.");
    else if (xCoord<0) && (yCoord>0)
        System.out.println("Point lies in Quadrant II.");
    else if (xCoord<0) && (yCoord<0)
        System.out.println("Point lies in Quadrant III.");
    else if (xCoord>0) && (yCoord<0)
        System.out.println("Point lies in Quadrant IV.")
    }
}
import java.util.*;
公共类Ch3Ex9{
/**
*此方法要求用户提供点的x、y坐标,然后返回
*到原点的距离以及点所在的象限。
*/
公共静态void main(字符串[]args)
{
double xCoord;//x坐标已初始化为3
双y坐标;//y坐标初始化为4
双斜边;//斜边
//声明Scanner的实例以从键盘读取数据流
扫描仪键盘=新扫描仪(System.in);
//从用户处获取x坐标
系统输出打印(“请输入X坐标:”;
xCoord=keyboard.nextDouble();
//从用户处获取Y坐标
系统输出打印(“请输入Y坐标:”;
yCoord=keyboard.nextDouble();
//计算斜边,即到原点的长度
hypo=数学hypo(xCoord,yCoord);
System.out.println(“斜边为”+hypo);
//确定用户输入点所在的象限
如果(xCoord>0)和(yCoord>0)//
System.out.println(“点位于象限I中”);
else if(xCoord0)
System.out.println(“点位于象限II”);

否则,如果(xCoord有太多的括号。更改

if (xCoord>0) && (yCoord>0) 


与其他类似。

如果Y==0--->位于X轴线上。如果X==0--->位于Y轴线上。两个0--->都位于中心。(不属于任何象限?)如果不解释问题是什么,很难帮助您解决问题。
if (xCoord>0 && yCoord>0)