0% found this document useful (0 votes)
39 views1 page

Class Object - Array - CS - ISC: 23 Jul, 2021 10:20:56 AM

The document contains a Java program that calculates midpoints between pairs of points entered by the user. It prompts the user for the number of points, reads the points, and then computes and displays the midpoints for each pair. The program utilizes an array of 'MidPoint' objects to store and process the points.

Uploaded by

Anubhav Dutta
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
39 views1 page

Class Object - Array - CS - ISC: 23 Jul, 2021 10:20:56 AM

The document contains a Java program that calculates midpoints between pairs of points entered by the user. It prompts the user for the number of points, reads the points, and then computes and displays the midpoints for each pair. The program utilizes an array of 'MidPoint' objects to store and process the points.

Uploaded by

Anubhav Dutta
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

Class Object_Array - CS_ISC 1/1

1 import java.util.*;
2 class Object_Array
3 {
4 public static void main(String args[])
5 {
6 Scanner in=new Scanner(System.in);
7 System.out.print("Enter number of points:");
8 int x=in.nextInt();
9 MidPoint[] mp=new MidPoint[x];
10 for(int i=0;i<x;i++)
11 {
12 mp[i]=new MidPoint();
13 System.out.print("Point"+(i+1)+":");
14 mp[i].readPoint();
15 }
16 MidPoint[] mid=new MidPoint[x/2];
17 for(int i=0;i<x/2;i++)
18 {
19 mid[i]=new MidPoint();
20 int l=mp.length;
21 mid[i]=mid[i].mPoint(mp[i],mp[l-i-1]);
22 }
23 for(int i=0;i<x/2;i++)
24 {
25 System.out.println("MidPoint no.:"+(i+1));
26 mid[i].display();
27 }
28 }
29 }

23 Jul, 2021 10:20:56 AM

You might also like