Hey everyone, I am working on this project and do not know where to start. Can anyone lead me in the right direction? I am very poor in this background and could use all the help I can get. So, any help would be very much appreciated. Here are the details:
- Problem Statement
Definition: A polyline is a sequence of points P1, P2, … , Pn in a plan. The points are determined by its coordinates: P1(x1, y1), P2 (x2, y2), … , Pn (xn, yn), n≥1.
A polyline is presented as an XML (text) file, called input2.txt. The tag names used in the file are:
• <point> // The tag for a point.
• <x> // The tag for x-coordinate.
• <y> // The tag for y-coordinate.
Example [A Polyline Represented as an XML file]
<Point> <x> 10 </x> <y> 10 </y> </Point>
<Point> <x> 20 </x> <y> 20 </y> </Point>
<x> 10 </x> <y> 40 </y>
<x> 40 </x>
<y> 40 </y>
<Point> <x> 30 </x> <y> 0 </y> </Point>
(A) Write a class PolyLine with the following interface (member functions):
• PolyLine – By default constructor for creating a polyline from an XML text file with name input2.txt.
• length - Calculates the length of the current polyline object (length = sum of all segments = P1P2 + P2P3 + … Pn-1Pn);
• insert – Inserts a new point in the polyline object (first, middle, last);
• remove – Removes a point from the polyline object;
• show – Show the current polyline object as sequence of (x, y) coordinates on the monitor;
• size – the current size of the polyline (number of points);
• store – Store the current polyline object as an XML text file output2.txt.
(B) Write a driver to test the PolyLine class. The driver should offer a friendly menu for multiple executions of all operations on a PolyLine object.
• Creates an object of class PolyLine.
• Calculating the length
• Inserting new node
• Removing a node
• Show the current polyline object
• Show the current size of the polyline
Input Data: input2.txt - XML text file, representing a polyline
Output Data: output2.txt - XML text file, representing the updated polyline.
The internal representation of the PolyLine must be a list. You could use the STL List class or you could create your own linked list class.