-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPoints.java
More file actions
37 lines (34 loc) · 1.27 KB
/
Points.java
File metadata and controls
37 lines (34 loc) · 1.27 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
import java.util.Arrays;
import java.util.Scanner;
public class Points {
public static void main(String [] args){
Scanner input = new Scanner(System.in);
System.out.println("How many pairs of x and y do you want to enter");
int amount = input.nextInt();
double[][] points = new double[amount][2]; //amount is the number
// of pairs and 2 is x and y
for(int i = 0; i < amount; i++ )
{
points[i][0] = input.nextDouble();
points[i][1] = input.nextDouble();
/**
* index of number 1 of the first array is points[0][0]
* index of number 2 of the first array is points[0][1]
* index of number 5 of the second array is points[1][0]
* index of number 6 of the second array is points[1][1]
*
* {{1,2},
* {5,6},
* {4,8}}
*/
// int x = input.nextInt();
// int y= input.nextInt();
// int [][]pairs = [x][y];
// for(int i = 0; i < pairs.length;i++){
// for(int j = 0; j < pairs[i].length; j++){
//
// }
}
System.out.println("The output of your pairs are " + Arrays.deepToString(points));
}
}