打印语句未显示我的输出

时间:2019-03-10 19:01:47

标签: java loops if-statement

对于我的作业,我正在研究一种绘制多项式曲线的方法。我开始显示20x20笛卡尔计划,但由于某些原因,未显示打印语句。有人可以帮我解决问题吗?谢谢

 public class PolynomialCurves{
      public static void main (String[] args) {

        double[] line = {1.0, 2};
        double lineThickness = 1;

        drawCurve(line, lineThickness, '$');
      }


    // A method that draws the graph of a polynomial curve

      public static void drawCurve(double[] coefficient, double thickness, char symbol) {

        // Loop that counts the y position

        for (int y = 20; y >= 0; y--) {

          if (y == 10) {

          // Loop that counts the x position

            for (int x = 0; x < 21; x++) {

              if (x == 10) {

                System.out.print('+');
              }

              else if (x == 20) {

              System.out.print('>');
              }

              else {
              System.out.print('-');
              }
            }
          }
        }

      }
    }

0 个答案:

没有答案