# (Solved) : Working Program Using C Adds Functionality Prototype Methods Defined Header File Provided Q42788659 . . .

Working on a program using C, that adds all the functionality toprototype methods that are defined in the header file provided(geometry.h) im having trouble implementing the functions I am notsure if my initialize method is correct although it does compile.What I really meed help with is how to add a point to the array,the method takes in a point that is a type struct that is refferedto by shapeT. I included the instructions and what I have so far,mostly just looking on how to add a point and maybe if myinitailize looks correct. Thank you!  * Assignment * CS Microsoft PowerPoint -Lex CS31: Intro to Structs ar x + 4.pdf GEOMETRY MODULE For this ment you will create mode that will maintain of the point in t imensionale and implement functions to the pond compute the w o r e the points. The header for the module is provided to u t type de prototypes for the functions the module implements Each postr ed by the following struct typedef strutt int na point number int x,y! //xy coordinate of point Note that each point is labeled with a point number. The module stores points in creates the array when the following function is called: array of Point values Shapet initialiteit capacity This functional memory forway of capacity points, and forhapet object may of length one stores a poster to the d o cuments by this function and the capacity typedet struct int size: int Capacity! Point points Shapeti The initial function Note that points is a partially filled array of length capacity and that is initially empty si returns a pointer to the Shape object, or returns NULL If either memory locations 0526F 2019 Points are added to the array using int add. Point Point point. Shapet shape a s a point or returns which adds a point to the way referred to by shape. This function returns w n da point because they point can be retrieved from the shape O Pointt getointitum, hapet shape): 1 mclude <stdio.hu include ostalib.h> include “geometry.” fndef GEOMETRY H #define GEOMETRY H typedef struct int num; //point number Ant x, y coordinate of point PointT: int main(int arge, char. argw typedef struct Shaper initializerint capacity Point FarrPoint – (PointTmalloc(capacity sizeof(Point)): Shapet shapebj – (ShapeTalloc(sizeof(ShapeT)) shapeObj-size = @ Shape Capacity – Capacity: Shape -points = arrPoint: If(arrPoint – NULL || shapebj = NULL) { return NULL: int capacity Point points ShapeT: 15 return shapebj: allocates memory for an array of capacity points and for a “Sage object (array of length ther stores a pointer to the array and keeps track For the current size (set to zero by this function) and the capacity. Return NULL IS memory allocation int addpoint Point point. Shapet shape) 22 Shapet initialize(int capacity): adds a point to the array referred to by ‘shape – This function returns fat successfully adds a point. – or returns if it can’t add a point because the array is full 26 28 int addPoint(Point point, Shape shape): 38 31 32 31 3 returns a point with label ne from the array referred to ” by Shape. Note that we are assuming that all points have distinct labels. If the pot with label ‘n isn’t in the array then getPoint returns a point with label mum 1and ‘w 36 Point getPoint(int nun, Shape shape) Show transcribed image text * Assignment * CS Microsoft PowerPoint -Lex CS31: Intro to Structs ar x + 4.pdf GEOMETRY MODULE For this ment you will create mode that will maintain of the point in t imensionale and implement functions to the pond compute the w o r e the points. The header for the module is provided to u t type de prototypes for the functions the module implements Each postr ed by the following struct typedef strutt int na point number int x,y! //xy coordinate of point Note that each point is labeled with a point number. The module stores points in creates the array when the following function is called: array of Point values Shapet initialiteit capacity This functional memory forway of capacity points, and forhapet object may of length one stores a poster to the d o cuments by this function and the capacity typedet struct int size: int Capacity! Point points Shapeti The initial function Note that points is a partially filled array of length capacity and that is initially empty si returns a pointer to the Shape object, or returns NULL If either memory locations 0526F 2019 Points are added to the array using int add. Point Point point. Shapet shape a s a point or returns which adds a point to the way referred to by shape. This function returns w n da point because they point can be retrieved from the shape O Pointt getointitum, hapet shape):
1 mclude include “geometry.” fndef GEOMETRY H #define GEOMETRY H typedef struct int num; //point number Ant x, y coordinate of point PointT: int main(int arge, char. argw typedef struct Shaper initializerint capacity Point FarrPoint – (PointTmalloc(capacity sizeof(Point)): Shapet shapebj – (ShapeTalloc(sizeof(ShapeT)) shapeObj-size = @ Shape Capacity – Capacity: Shape -points = arrPoint: If(arrPoint – NULL || shapebj = NULL) { return NULL: int capacity Point points ShapeT: 15 return shapebj: allocates memory for an array of capacity points and for a “Sage object (array of length ther stores a pointer to the array and keeps track For the current size (set to zero by this function) and the capacity. Return NULL IS memory allocation int addpoint Point point. Shapet shape) 22 Shapet initialize(int capacity): adds a point to the array referred to by ‘shape – This function returns fat successfully adds a point. – or returns if it can’t add a point because the array is full 26 28 int addPoint(Point point, Shape shape): 38 31 32 31 3 returns a point with label ne from the array referred to ” by Shape. Note that we are assuming that all points have distinct labels. If the pot with label ‘n isn’t in the array then getPoint returns a point with label mum 1and ‘w 36 Point getPoint(int nun, Shape shape)

Answer to Working on a program using C, that adds all the functionality to prototype methods that are defined in the header file p…

We are the best freelance writing portal. Looking for online writing, editing or proofreading jobs? We have plenty of writing assignments to handle.