Question: import java.util.Scanner; class Main { public static void main(String[] args) { int x, y; Scanner input = new Scanner(System.in); // Prompt user for two coordinate
import java.util.Scanner;
class Main { public static void main(String[] args) {
int x, y; Scanner input = new Scanner(System.in);
// Prompt user for two coordinate values System.out.println("Enter x,y values of coord1 " + "(on the same line with a space between):"); //
// Create object coord1 //
// Displays the values of coord1 and coord2 by use // of the toString method, to appear EXACTLY as // follows: // coord1 has the value (x,x) // coord2 has the value (x,x) //
// Displays whether coord1 and coord2 are equal by // use of the equals method of the XYCoord class // to appear EXACTLY as follows: // "coord1 and coord2 are equal" or // "coord1 and coord2 are not equal" //
// Displays the distance between coord1 and coord2 // by use of the distance method of the XYCoord // class EXACTLY as follows: // "Distance between coord1 and coord2 = xx.xx" //
// Displays whether or not coord1 is within the // rectrangular area specified by (0,0) and (10,10) // by use of the withinArea method of the XYCoord // class EXACTLY as follows: // "coord1 within the area" OR // "coord1 not within the area" //
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
