不需要都写,能不能帮我整理大概,然后就写出 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.");
}
}