weixin_45710228 2019-10-03 08:36 采纳率: 0%
浏览 388
已采纳

老师给的Java问题要在BlueJ 上面做,求大神

不需要都写,能不能帮我整理大概,然后就写出 Enter 1 时候的method就行了
不需要都写,能不能帮我整理大概,然后就写出 Enter 1 时候的method就行了
非常感谢

图片说明图片说明图片说明

是这个样子的, 真的刚入门,超新手,救救孩子吧
import java.util.*;

public class CoordinateMath {

//Write your methods here
//
//
//

public static void main(String[] args) {

   //Initialize the variables that will be filled in by the user
    double x1 = 0;
    double y1 = 0;
    double x2 = 0;
    double y2 = 0;

    int userChoice = -1;

    //Gather User Input
    System.out.println("This program can calculate a lot of information based upon two points (x1,y1) & (x2,y2)");

    Scanner in = new Scanner(System.in);

    System.out.println("What is the location of x1? ");
    x1= in.nextDouble();

    System.out.println("What is the location of y1? ");
    y1= in.nextDouble();

    System.out.println("What is the location of x2? ");
    x2= in.nextDouble();

    System.out.println("What is the location of y2? ");
    y2= in.nextDouble();

    System.out.println(" ");

    //Start calling Methods based upon user input

    while(userChoice != 0){

    System.out.println("\nWhat would you like to calculate given these two points?");
    System.out.println("Enter 1 to have your two points re-printed.");
    System.out.println("Enter 2 to locate the midpoint between the two given points.");
    System.out.println("Enter 3 to calculate the distance between your two points.");
    System.out.println("Enter 4 to calculate the slope of the line connecting the two points.");
    System.out.println("Enter 5 to calculate the Y intercept of the line connecting the two points.");
    System.out.println("Enter 6 to calculate the equation of your line in Slope Intercept form.");
    System.out.println("Enter 7 to find the quadrant for point 1.");
    System.out.println("Enter 8 to find the quadrant for point 2.");
    System.out.println("Enter 9 to quit");
    userChoice = in.nextInt(); 

    // If 1 call a method that re-displays the location of the points based upon the user input


    // If 2 call a method that displays the midpoint 


    // If 3 call a method that that displays distance between the two points


    // If 4 call a method that displays the slope of the line that connects the two points

    // If 5 call a method that displays the Y Intercept the line


    // If 6 call a method that displays the equation of the line in slope intercept form y=mx+b


    // If 7 call a method that displays the quadrant of point 1.


    // If 8 call a method that displays the quadrant of point 2.


  }

 System.out.println("Thank you for using my coordinate program.  Good bye.");
}

}

  • 写回答

1条回答 默认 最新

  • dabocaiqq 2019-10-03 09:33
    关注

    问题比较多
    userChoice = in.nextInt();
    这里加上
    switch (userChoice)
    {
    case 1:
    重新显示点的坐标
    break;
    case 2:
    ...
    }
    按照这个写就可以了。

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 sqlite 附加(attach database)加密数据库时,返回26是什么原因呢?
  • ¥88 找成都本地经验丰富懂小程序开发的技术大咖
  • ¥15 如何处理复杂数据表格的除法运算
  • ¥15 如何用stc8h1k08的片子做485数据透传的功能?(关键词-串口)
  • ¥15 有兄弟姐妹会用word插图功能制作类似citespace的图片吗?
  • ¥200 uniapp长期运行卡死问题解决
  • ¥15 latex怎么处理论文引理引用参考文献
  • ¥15 请教:如何用postman调用本地虚拟机区块链接上的合约?
  • ¥15 为什么使用javacv转封装rtsp为rtmp时出现如下问题:[h264 @ 000000004faf7500]no frame?
  • ¥15 乘性高斯噪声在深度学习网络中的应用