java 非法表达式开始_java 非法的表达式开始

importjava.util.Scanner;publicclassTriangles{publicstaticvoidmain(String[]args){doubleX1,Y1,X2,Y2,X3,Y3,POT;finaldoubleminX=0;finaldoubleminY=0;finaldoublemaxX=40;finaldo...

import java.util.Scanner;

public class Triangles

{

public static void main(String[] args)

{

double X1,Y1,X2,Y2,X3,Y3,POT;

final double minX = 0;

final double minY = 0;

final double maxX = 40;

final double maxY = 40;

Scanner input = new Scanner(System.in);

System.out.print("Tis program calculates the perimeter of a Triangle.");

if (X1 >= minX || X1 <= maxX)

System.out.print("Enter X of point 1:");

else

{

System.out.println("Your X1 value is not accpect for this program, please enter the value between 0 to 40.");

X1 = input.nextDouble();

}

if(Y1 >= minY || Y1 <= maxY)

System.out.print("Enter Y of point 1:");

else

{

System.out.println("Your Y1 value is not accpect for this program, please enter the value between 0 to 40.");

Y1 = input.nextDouble();

}

if(X2 >= minX || X2 <= maxX)

System.out.print("Enter X of point 2:");

else

{

System.out.println("Your X2 value is not accpect for this program, please enter the value between 0 to 40.");

X2 = input.nextDouble();

}

if(Y2 >= minY || Y2 <= maxY)

System.out.print("Enter X of point 2:");

else

{

System.out.println("Your Y2 value is not accpect for this program, please enter the value between 0 to 40.");

Y2 = input.nextDouble();

}

if(X3 >= minX || X3 <= maxX)

System.out.print("Enter X of point 3:");

else

{

System.out.println("Your X3 value is not accpect for this program, please enter the value between 0 to 40.");

X3 = input.nextDouble();

}

if(Y3 >= minY || Y3 <= maxY)

System.out.print("Enter X of point 3:");

else

{

System.out.println("Your Y3 value is not accpect for this program, please enter the value between 0 to 40.");

Y3 = input.nextDouble();

}

POT = (Math.sqrt(Math.pow(X2-X1,2)) + (Math.pow(Y2-Y1,2)))+(Math.sqrt(Math.pow(X3-X1,2)) + (Math.pow(Y3-Y1,2)))+(Math.sqrt(Math.pow(X2-X3,2)) + (Math.pow(Y3-Y2,2)));

System.out.println("The perimeter of Triangle with Point1("+X1+","+Y1+"),point2("+X2+","+Y2+", and point3("+X3+","+Y3+")");

System.out.println("is"+POT+);

}

}

>javac Triangles.java

Triangles.java:80: 错误: 非法的表达式开始

System.out.println("is"+POT+);

^

1 个错误

>Exit code: 1

展开

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值