SlideShare a Scribd company logo
1 of 4
Download to read offline
// Points.java
import java.util.ArrayList;
import java.util.Scanner;
public class Points{
double x;
double y;
Points(double xco, double yco){
x = xco;
y = yco;
}
}
// PolygonArea.java
import java.util.ArrayList;
import java.util.Scanner;
public class PolygonArea {
// funtion to determine area of polygon
public static double getArea(ArrayList coordinates) {
double sumxy = 0;
double sumyx = 0;
for (int i = 0; i < coordinates.size(); i++) {
int index = (i + 1) % coordinates.size();
Points point1 = coordinates.get(i);
Points point2 = coordinates.get(index);
sumxy += (point1.x * point2.y);
sumyx += (point1.y * point2.x);
}
double areaPolygon = 0.5 * (sumxy - sumyx);
if (areaPolygon > 0)
return areaPolygon;
else
return -areaPolygon;
}
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
System.out.print("Enter the number of the points: ");
int totalPoints = scan.nextInt();
System.out.print("Enter the coordinates of the points: ");
ArrayList coordinates = new ArrayList<>();
for (int i = 0; i < totalPoints; i++) {
coordinates.add(new Points(scan.nextDouble(), scan.nextDouble()));
}
System.out.println("The total area is " + getArea(coordinates));
}
}
/*
output:
Enter the number of the points: 3
Enter the coordinates of the points: 0 0 0 3 4 0
The total area is 6.0
*/
Solution
// Points.java
import java.util.ArrayList;
import java.util.Scanner;
public class Points{
double x;
double y;
Points(double xco, double yco){
x = xco;
y = yco;
}
}
// PolygonArea.java
import java.util.ArrayList;
import java.util.Scanner;
public class PolygonArea {
// funtion to determine area of polygon
public static double getArea(ArrayList coordinates) {
double sumxy = 0;
double sumyx = 0;
for (int i = 0; i < coordinates.size(); i++) {
int index = (i + 1) % coordinates.size();
Points point1 = coordinates.get(i);
Points point2 = coordinates.get(index);
sumxy += (point1.x * point2.y);
sumyx += (point1.y * point2.x);
}
double areaPolygon = 0.5 * (sumxy - sumyx);
if (areaPolygon > 0)
return areaPolygon;
else
return -areaPolygon;
}
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
System.out.print("Enter the number of the points: ");
int totalPoints = scan.nextInt();
System.out.print("Enter the coordinates of the points: ");
ArrayList coordinates = new ArrayList<>();
for (int i = 0; i < totalPoints; i++) {
coordinates.add(new Points(scan.nextDouble(), scan.nextDouble()));
}
System.out.println("The total area is " + getArea(coordinates));
}
}
/*
output:
Enter the number of the points: 3
Enter the coordinates of the points: 0 0 0 3 4 0
The total area is 6.0
*/

More Related Content

Similar to Points.java import java.util.ArrayList; import java.util.Scan.pdf

Need Help with this Java Assignment. Program should be done in JAVA .pdf
Need Help with this Java Assignment. Program should be done in JAVA .pdfNeed Help with this Java Assignment. Program should be done in JAVA .pdf
Need Help with this Java Assignment. Program should be done in JAVA .pdf
archiesgallery
 
Mashup caravan android-talks
Mashup caravan android-talksMashup caravan android-talks
Mashup caravan android-talks
honjo2
 
Hi,I have modified the Point.java file as per your requirement.P.pdf
Hi,I have modified the Point.java file as per your requirement.P.pdfHi,I have modified the Point.java file as per your requirement.P.pdf
Hi,I have modified the Point.java file as per your requirement.P.pdf
anokhijew
 
import java-util--- public class MyLinkedList{ public static void.pdf
import java-util---  public class MyLinkedList{    public static void.pdfimport java-util---  public class MyLinkedList{    public static void.pdf
import java-util--- public class MyLinkedList{ public static void.pdf
asarudheen07
 
SaveI need help with this maze gui that I wrote in java, I am tryi.pdf
SaveI need help with this maze gui that I wrote in java, I am tryi.pdfSaveI need help with this maze gui that I wrote in java, I am tryi.pdf
SaveI need help with this maze gui that I wrote in java, I am tryi.pdf
arihantstoneart
 
public class TrequeT extends AbstractListT { .pdf
  public class TrequeT extends AbstractListT {  .pdf  public class TrequeT extends AbstractListT {  .pdf
public class TrequeT extends AbstractListT { .pdf
info30292
 
Java code to find the closest pair using divide and conquer algorith.pdf
Java code to find the closest pair using divide and conquer algorith.pdfJava code to find the closest pair using divide and conquer algorith.pdf
Java code to find the closest pair using divide and conquer algorith.pdf
fashioncollection2
 
New folderjsjfArrayStack.classpackage jsjf;publicsynchronize.docx
New folderjsjfArrayStack.classpackage jsjf;publicsynchronize.docxNew folderjsjfArrayStack.classpackage jsjf;publicsynchronize.docx
New folderjsjfArrayStack.classpackage jsjf;publicsynchronize.docx
curwenmichaela
 
Get started with YUI
Get started with YUIGet started with YUI
Get started with YUI
Adam Lu
 
-- USING UNITY TRYING TO CREATE A CLICK TO PATH- THAT YOU CLICK ON AND.pdf
-- USING UNITY TRYING TO CREATE A CLICK TO PATH- THAT YOU CLICK ON AND.pdf-- USING UNITY TRYING TO CREATE A CLICK TO PATH- THAT YOU CLICK ON AND.pdf
-- USING UNITY TRYING TO CREATE A CLICK TO PATH- THAT YOU CLICK ON AND.pdf
ganisyedtrd
 

Similar to Points.java import java.util.ArrayList; import java.util.Scan.pdf (20)

Need Help with this Java Assignment. Program should be done in JAVA .pdf
Need Help with this Java Assignment. Program should be done in JAVA .pdfNeed Help with this Java Assignment. Program should be done in JAVA .pdf
Need Help with this Java Assignment. Program should be done in JAVA .pdf
 
Applications
ApplicationsApplications
Applications
 
Mashup caravan android-talks
Mashup caravan android-talksMashup caravan android-talks
Mashup caravan android-talks
 
Hi,I have modified the Point.java file as per your requirement.P.pdf
Hi,I have modified the Point.java file as per your requirement.P.pdfHi,I have modified the Point.java file as per your requirement.P.pdf
Hi,I have modified the Point.java file as per your requirement.P.pdf
 
OBJECTS IN Object Oriented Programming .ppt
OBJECTS IN Object Oriented Programming .pptOBJECTS IN Object Oriented Programming .ppt
OBJECTS IN Object Oriented Programming .ppt
 
import java-util--- public class MyLinkedList{ public static void.pdf
import java-util---  public class MyLinkedList{    public static void.pdfimport java-util---  public class MyLinkedList{    public static void.pdf
import java-util--- public class MyLinkedList{ public static void.pdf
 
Java final project of scientific calcultor
Java final project of scientific calcultorJava final project of scientific calcultor
Java final project of scientific calcultor
 
Chapter 7 functions (c)
Chapter 7 functions (c)Chapter 7 functions (c)
Chapter 7 functions (c)
 
SaveI need help with this maze gui that I wrote in java, I am tryi.pdf
SaveI need help with this maze gui that I wrote in java, I am tryi.pdfSaveI need help with this maze gui that I wrote in java, I am tryi.pdf
SaveI need help with this maze gui that I wrote in java, I am tryi.pdf
 
public class TrequeT extends AbstractListT { .pdf
  public class TrequeT extends AbstractListT {  .pdf  public class TrequeT extends AbstractListT {  .pdf
public class TrequeT extends AbstractListT { .pdf
 
Operator overloading (binary)
Operator overloading (binary)Operator overloading (binary)
Operator overloading (binary)
 
Java code to find the closest pair using divide and conquer algorith.pdf
Java code to find the closest pair using divide and conquer algorith.pdfJava code to find the closest pair using divide and conquer algorith.pdf
Java code to find the closest pair using divide and conquer algorith.pdf
 
New folderjsjfArrayStack.classpackage jsjf;publicsynchronize.docx
New folderjsjfArrayStack.classpackage jsjf;publicsynchronize.docxNew folderjsjfArrayStack.classpackage jsjf;publicsynchronize.docx
New folderjsjfArrayStack.classpackage jsjf;publicsynchronize.docx
 
Get started with YUI
Get started with YUIGet started with YUI
Get started with YUI
 
How to add an optimization for C# to RyuJIT
How to add an optimization for C# to RyuJITHow to add an optimization for C# to RyuJIT
How to add an optimization for C# to RyuJIT
 
Scientific calcultor-Java
Scientific calcultor-JavaScientific calcultor-Java
Scientific calcultor-Java
 
-- USING UNITY TRYING TO CREATE A CLICK TO PATH- THAT YOU CLICK ON AND.pdf
-- USING UNITY TRYING TO CREATE A CLICK TO PATH- THAT YOU CLICK ON AND.pdf-- USING UNITY TRYING TO CREATE A CLICK TO PATH- THAT YOU CLICK ON AND.pdf
-- USING UNITY TRYING TO CREATE A CLICK TO PATH- THAT YOU CLICK ON AND.pdf
 
Functional Programming
Functional ProgrammingFunctional Programming
Functional Programming
 
Advanced JavaScript
Advanced JavaScript Advanced JavaScript
Advanced JavaScript
 
import java.util.Scanner;public class Factorial { method usi.pdf
import java.util.Scanner;public class Factorial { method usi.pdfimport java.util.Scanner;public class Factorial { method usi.pdf
import java.util.Scanner;public class Factorial { method usi.pdf
 

More from KUNALHARCHANDANI1

Static Keyword Static is a keyword in C++ used to give special chara.pdf
  Static Keyword Static is a keyword in C++ used to give special chara.pdf  Static Keyword Static is a keyword in C++ used to give special chara.pdf
Static Keyword Static is a keyword in C++ used to give special chara.pdf
KUNALHARCHANDANI1
 
Which of the following would be a description of a system unitA c.pdf
Which of the following would be a description of a system unitA c.pdfWhich of the following would be a description of a system unitA c.pdf
Which of the following would be a description of a system unitA c.pdf
KUNALHARCHANDANI1
 
Water is a polar inorganic solvent. Benzene is a nonpolar organic so.pdf
Water is a polar inorganic solvent. Benzene is a nonpolar organic so.pdfWater is a polar inorganic solvent. Benzene is a nonpolar organic so.pdf
Water is a polar inorganic solvent. Benzene is a nonpolar organic so.pdf
KUNALHARCHANDANI1
 
viruses which have single strande DNA in their genome come under cat.pdf
viruses which have single strande DNA in their genome come under cat.pdfviruses which have single strande DNA in their genome come under cat.pdf
viruses which have single strande DNA in their genome come under cat.pdf
KUNALHARCHANDANI1
 
This word problem is about a triangle whose perimeter is 47 miles. S.pdf
This word problem is about a triangle whose perimeter is 47 miles. S.pdfThis word problem is about a triangle whose perimeter is 47 miles. S.pdf
This word problem is about a triangle whose perimeter is 47 miles. S.pdf
KUNALHARCHANDANI1
 

More from KUNALHARCHANDANI1 (20)

The metal will undergo oxidation forming metal ion and releasing .pdf
 The metal will undergo oxidation forming metal ion and releasing .pdf The metal will undergo oxidation forming metal ion and releasing .pdf
The metal will undergo oxidation forming metal ion and releasing .pdf
 
Static Keyword Static is a keyword in C++ used to give special chara.pdf
  Static Keyword Static is a keyword in C++ used to give special chara.pdf  Static Keyword Static is a keyword in C++ used to give special chara.pdf
Static Keyword Static is a keyword in C++ used to give special chara.pdf
 
Sr2+ is most likely to substitute for Ca2+ becaus.pdf
                     Sr2+ is most likely to substitute for Ca2+ becaus.pdf                     Sr2+ is most likely to substitute for Ca2+ becaus.pdf
Sr2+ is most likely to substitute for Ca2+ becaus.pdf
 
may be that peak id due to presence of alkyl gro.pdf
                     may be that peak id due to presence of  alkyl gro.pdf                     may be that peak id due to presence of  alkyl gro.pdf
may be that peak id due to presence of alkyl gro.pdf
 
There should only have one singlet resonance for .pdf
                     There should only have one singlet resonance for .pdf                     There should only have one singlet resonance for .pdf
There should only have one singlet resonance for .pdf
 
the link is not working can u pls write questions.pdf
                     the link is not working can u pls write questions.pdf                     the link is not working can u pls write questions.pdf
the link is not working can u pls write questions.pdf
 
The one have higher value of E(cell) is acting as.pdf
                     The one have higher value of E(cell) is acting as.pdf                     The one have higher value of E(cell) is acting as.pdf
The one have higher value of E(cell) is acting as.pdf
 
Nicotine has a molecular formula of C10H14N2 .pdf
                     Nicotine has a molecular formula of C10H14N2     .pdf                     Nicotine has a molecular formula of C10H14N2     .pdf
Nicotine has a molecular formula of C10H14N2 .pdf
 
i have it .pdf
                     i have it                                      .pdf                     i have it                                      .pdf
i have it .pdf
 
HClO4 in aqueous medium ionizes as Hydrogen(+1)ca.pdf
                     HClO4 in aqueous medium ionizes as Hydrogen(+1)ca.pdf                     HClO4 in aqueous medium ionizes as Hydrogen(+1)ca.pdf
HClO4 in aqueous medium ionizes as Hydrogen(+1)ca.pdf
 
Which of the following would be a description of a system unitA c.pdf
Which of the following would be a description of a system unitA c.pdfWhich of the following would be a description of a system unitA c.pdf
Which of the following would be a description of a system unitA c.pdf
 
Water is a polar inorganic solvent. Benzene is a nonpolar organic so.pdf
Water is a polar inorganic solvent. Benzene is a nonpolar organic so.pdfWater is a polar inorganic solvent. Benzene is a nonpolar organic so.pdf
Water is a polar inorganic solvent. Benzene is a nonpolar organic so.pdf
 
viruses which have single strande DNA in their genome come under cat.pdf
viruses which have single strande DNA in their genome come under cat.pdfviruses which have single strande DNA in their genome come under cat.pdf
viruses which have single strande DNA in their genome come under cat.pdf
 
This word problem is about a triangle whose perimeter is 47 miles. S.pdf
This word problem is about a triangle whose perimeter is 47 miles. S.pdfThis word problem is about a triangle whose perimeter is 47 miles. S.pdf
This word problem is about a triangle whose perimeter is 47 miles. S.pdf
 
CH4 + 2O2 -- CO2 + 2H2O note CH4 combustion is.pdf
                     CH4 + 2O2 -- CO2 + 2H2O  note CH4 combustion is.pdf                     CH4 + 2O2 -- CO2 + 2H2O  note CH4 combustion is.pdf
CH4 + 2O2 -- CO2 + 2H2O note CH4 combustion is.pdf
 
SbAspnSolutionSbAspn.pdf
SbAspnSolutionSbAspn.pdfSbAspnSolutionSbAspn.pdf
SbAspnSolutionSbAspn.pdf
 
Carbon 2 is where D and L differ for all sugars. .pdf
                     Carbon 2 is where D and L differ for all sugars. .pdf                     Carbon 2 is where D and L differ for all sugars. .pdf
Carbon 2 is where D and L differ for all sugars. .pdf
 
Program to print the Diamond Shape -#include stdio.h int ma.pdf
Program to print the Diamond Shape -#include stdio.h int ma.pdfProgram to print the Diamond Shape -#include stdio.h int ma.pdf
Program to print the Diamond Shape -#include stdio.h int ma.pdf
 
Part D option 4 is answerUnless untill they are exposed by some me.pdf
Part D option 4 is answerUnless untill they are exposed by some me.pdfPart D option 4 is answerUnless untill they are exposed by some me.pdf
Part D option 4 is answerUnless untill they are exposed by some me.pdf
 
Isomers which have their atoms connected in the same sequence but di.pdf
Isomers which have their atoms connected in the same sequence but di.pdfIsomers which have their atoms connected in the same sequence but di.pdf
Isomers which have their atoms connected in the same sequence but di.pdf
 

Recently uploaded

Recently uploaded (20)

REMIFENTANIL: An Ultra short acting opioid.pptx
REMIFENTANIL: An Ultra short acting opioid.pptxREMIFENTANIL: An Ultra short acting opioid.pptx
REMIFENTANIL: An Ultra short acting opioid.pptx
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdf
 
Fostering Friendships - Enhancing Social Bonds in the Classroom
Fostering Friendships - Enhancing Social Bonds  in the ClassroomFostering Friendships - Enhancing Social Bonds  in the Classroom
Fostering Friendships - Enhancing Social Bonds in the Classroom
 
On_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptx
On_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptxOn_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptx
On_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptx
 
FSB Advising Checklist - Orientation 2024
FSB Advising Checklist - Orientation 2024FSB Advising Checklist - Orientation 2024
FSB Advising Checklist - Orientation 2024
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptx
 
Micro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdfMicro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdf
 
Food safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdfFood safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdf
 
On National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsOn National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan Fellows
 
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdfUGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
 
Exploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptx
Exploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptxExploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptx
Exploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptx
 
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptxCOMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
 
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
 
How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17
 
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptxHMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
 
Plant propagation: Sexual and Asexual propapagation.pptx
Plant propagation: Sexual and Asexual propapagation.pptxPlant propagation: Sexual and Asexual propapagation.pptx
Plant propagation: Sexual and Asexual propapagation.pptx
 
Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024
 
Interdisciplinary_Insights_Data_Collection_Methods.pptx
Interdisciplinary_Insights_Data_Collection_Methods.pptxInterdisciplinary_Insights_Data_Collection_Methods.pptx
Interdisciplinary_Insights_Data_Collection_Methods.pptx
 
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
 
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
 

Points.java import java.util.ArrayList; import java.util.Scan.pdf

  • 1. // Points.java import java.util.ArrayList; import java.util.Scanner; public class Points{ double x; double y; Points(double xco, double yco){ x = xco; y = yco; } } // PolygonArea.java import java.util.ArrayList; import java.util.Scanner; public class PolygonArea { // funtion to determine area of polygon public static double getArea(ArrayList coordinates) { double sumxy = 0; double sumyx = 0; for (int i = 0; i < coordinates.size(); i++) { int index = (i + 1) % coordinates.size(); Points point1 = coordinates.get(i); Points point2 = coordinates.get(index); sumxy += (point1.x * point2.y); sumyx += (point1.y * point2.x); } double areaPolygon = 0.5 * (sumxy - sumyx); if (areaPolygon > 0) return areaPolygon; else return -areaPolygon; } public static void main(String[] args) { Scanner scan = new Scanner(System.in); System.out.print("Enter the number of the points: ");
  • 2. int totalPoints = scan.nextInt(); System.out.print("Enter the coordinates of the points: "); ArrayList coordinates = new ArrayList<>(); for (int i = 0; i < totalPoints; i++) { coordinates.add(new Points(scan.nextDouble(), scan.nextDouble())); } System.out.println("The total area is " + getArea(coordinates)); } } /* output: Enter the number of the points: 3 Enter the coordinates of the points: 0 0 0 3 4 0 The total area is 6.0 */ Solution // Points.java import java.util.ArrayList; import java.util.Scanner; public class Points{ double x; double y; Points(double xco, double yco){ x = xco; y = yco; } } // PolygonArea.java import java.util.ArrayList; import java.util.Scanner; public class PolygonArea {
  • 3. // funtion to determine area of polygon public static double getArea(ArrayList coordinates) { double sumxy = 0; double sumyx = 0; for (int i = 0; i < coordinates.size(); i++) { int index = (i + 1) % coordinates.size(); Points point1 = coordinates.get(i); Points point2 = coordinates.get(index); sumxy += (point1.x * point2.y); sumyx += (point1.y * point2.x); } double areaPolygon = 0.5 * (sumxy - sumyx); if (areaPolygon > 0) return areaPolygon; else return -areaPolygon; } public static void main(String[] args) { Scanner scan = new Scanner(System.in); System.out.print("Enter the number of the points: "); int totalPoints = scan.nextInt(); System.out.print("Enter the coordinates of the points: "); ArrayList coordinates = new ArrayList<>(); for (int i = 0; i < totalPoints; i++) { coordinates.add(new Points(scan.nextDouble(), scan.nextDouble())); } System.out.println("The total area is " + getArea(coordinates)); } } /* output: Enter the number of the points: 3 Enter the coordinates of the points: 0 0 0 3 4 0 The total area is 6.0
  • 4. */