Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please help with C++ assignment question. Please provide code with comments. University of Wollongong School of Computing and Information Technology cscmsi Advanced Programming Assignment 3

Please help with C++ assignment question.

Please provide code with comments.

image text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribed
University of Wollongong School of Computing and Information Technology cscmsi Advanced Programming Assignment 3 Ai_m The objectives of this assignment includes: - Learning about generic programming templates, operator overloading, STL (containers & algorithms) and writing ic manipulators - Apply the concepts learnt by developing a data processing program Background In this assignment, you are required to develop a program that reads in and process some 'messy' records from a file that contains data meant for different kinds of classes, These data are jumbled up and unsorted, and to make it worse, for any particular row of record, there may be multiple duplicates scattered over the entire le! You program should be called 'csci251_a3.exe', and should posses the following capabilities: a) read in the records from a user-specified filename b) remove all duplicate rows of data c) filter and display the data according to user-specified sorting criteria :1) store the records displayed in c). in a user-specified filename The next section provides information about the requirements for developing this program: Task Reguirements A) Appendix A provides a sample input data from a file called 'messy.txt'. It contains information meant to be stored in 4 classes: 'PointZD', 'PointBD', 'LineZD' and 'LineBD'. Please refer to the table in Appendix A for a description of the format in which the input data for each of the classes is stored B) Note1: You are to research and determine which kind of STL containers (e.g. Map, Vector, Set, Lists etc) you should use, to store all the various objects from the 4 classes. For this assignment you are not allowed to use array [ ] to store any of your datai 0) Appendix B provides a description of the 4 classes: 'PointZD', 'Point3D', 'LineZD' and 'Linesb', and the relationships between them. You are to study the diagrams and implement them accordingly. Page 1 of21 University ol Wollongong School at Computing and lnlormation Technology cscrzsr Advanced Programming D) Appendix C provides the sample output format and a description of the format reguirements, for each of the 4 classes. These format are to be applied whether the data from these classes are output to a file or terminal. E) Note2: To output data, you are required to create your own output manipulatorgs) to display/store data in the format described in Appendix C. You are further required to overload the insertion operator ') called 'sort'. You should research on its usage. code the necessary comparator functions (for each of the 4 classes + sorting criteria). Once you mastered its usage. you will easily achieve the desired sorting effect using less than 3 lines of code! To assist you in visualizing the desired program interactions, please refer to Appendix F which provides a sample menu displaying the output data / messages in response to user input, Once the program is completed and tested to be working successfully, you are highly encouraged to add on "new features\" to the program that you feel are relevant to the problem. Additional marks may be awarded subject to the relevancy and correctness of the new functionalities. ( Note : the additional features will only be considered IF the program has correctly fulfilled all the basic requirements elaborated in the earlier sections!) M) You are to use only C++ language to develop your program. There is no restriction on the IDE as long as your source les can be compiled by 944 compiler (that comes packaged in Ubuntu linux) and executed in the Ubuntu terminal shell environment. Page 3 of 21 University of Wollongong University of Wollongong School of Computing and Information Technology School of Computing and Information Technology CSC1251 Advanced Pro CSC1251 Advanced Programming Deliverables Tutor's note: n the real working world, satisfactory completion of your tasks is no longer enough. The 1) The deliverables include the following: capability, efficiency and robustness of your system to operate under different testing conditions, and the ability to add value, communicate and/or demonstrate your ideas with clarity is just as a) The actual working C++ program (soft copy), with comments on each file, important as correct functioning of your program. The grading criteria is set to imitate such function or block of code to help the tutor understand its purpose. requirements on a 'smaller scale'. b) A softcopy word document that elaborates on: (Interpreted) requirements of the program Diagram / Illustrations of program design Summary of implementation of each module in your program . Reflections on program development (e.g. assumptions made, difficulties faced, what could have been done better, possible enhancements in future, what have you learnt, etc) c) A program demo/software testing during lab session. You must be prepared to perform certain tasks / answer any questions posed by the tutor. 2 IMPT: Please follow closely, to the submission instructions in Appendix G, which contains details about what to submit, file naming conventions, when to submit, where to submit, etc. 3) The software demo / testing will be held during lab session where you are supposed to submit your assignment. Some time will be allocated for you to present / demonstrate your program's capabilities during the session. Grading Student's deliverable will be graded according to the following criteria: (i) Program fulfills all the basic requirements stipulated by the assignment (ii) Successful demonstration of a working program, clarity of explanation / presentation and satisfactory answers provided during Q & A session. (iii) Additional effort (e.g. enhancing the program with relevant features over and above task requirements, impressive, 'killer presentation) (iv) After the submission of deliverables, students will be required undergo a software testing process (to determine the correctness and fulfillment of software requirements. ) Further instructions will be given by the Tutor during the subsequent respective labs. Please pay attention as failure to adhere to instructions will result in deduction of marks. Page 4 of 21 Page 5 of 21University of Wollongong University of Wollongong School of Computing and Information Technology School of Computing and Information Technology CSC1251 Advanced Programming CSC1251 Advanced Programming APPENDIX A APPENDIX B (Sample 'messy' data from an input file) (The 4 classes, and their relationships) Point2D, [3, 2] Line3D, [7, 12, 3], [-9, 13, 68] Point2D Line20 Point3D, [1, 3, 8] # x: in pt1: Point2D Line2D, [5, 7], [3, 8] # y: in - pt2: Point2 Point2D, [3, 2] # distFrOrigin: double Line3D, [7, -12, 3], [9, 13, 68] # length: double Point3D, [6, 9, 5] Point2D, [3, 2] # setDistFrOrigin 0 # setLength 0 Line3D, [70, -120, -3], [-29, 1, 268] Line3D, [25, -69, -33], [-2, -41, 58] + Point2D (x: int, y: int) + Line2D (pt1: Point2D, pt2: Point2D) Point3D, [6, 9, -50] + getx () : int + getPt1 () : Point20 . . . + getY () : int + getPt2 () : Point2 + getScalarValue () : double + getScalarValue () : double + setX (x: int) + setPt1 (pt1: Point2D) Note: + setY (y: int) + setPt2 (pt2: Point2D) 1) Some data, (e.g. 'Point2D, [3, 2]') can be repeated multiple times (i.e. they are duplicated data), this applies to all other kinds of data as well. 2) In each line, the 1" field will contain the class's name (e.g. 'Point2D', 'Point3D', 'Line2D' and 'Line 3D') Point3D Line3D # z: int - pt1: Point3D 3) The delimiter separating the 15 field from the rest of the data, is a comma, followed by a - pt2: Point3D space char (i.e. ', ') # setDistFrOrigin 0 4) The delimiter separating each number in the 2D/3D coordinate, is also a comma, followed + Point3D (x: int, y: int, z: int) # setLength O by a space char (i.e. ', ') + Line3D (pt1: Point3D, pt2: Point3D) + getz () : int + getPt1 () : Point3D 5) Each 2D/3D point's data, is enclosed by the square brackets '[' and ]' + setZ (z: int) + getPt2 () : Point3D 6) Each Line2D / Line3D's data consists of two points, each enclosed by square brackets, + setPt1 (pt1: Point3D) + setPt2 (pt2: Point3D) and the delimiter separating each point is also a comma, followed by a space char (i.e. ', ') 7) You may assume that the range of each number in the x, y or z coordinate can be anything from -999 to 999 Page 6 of 21 Page 7 of 21University of Wollongong University of Wollongong School of Computing and Information Technology School of Computing and Information Technology CSC1251 Advanced Programming CSC1251 Advanced Programming APPENDIX B (con't) APPENDIX C Note (General Output Format for Point2D & Point3D data) 1) The above diagrams depict the bare minimum requirements for the 4 classes whose attributes and methods you MUST implement Point2D 2) In Point2D class, setDistFrorigin () method computes the distance of the point to X Y Dist. Fr Origin the origin (0, 0), and initializes the attribute distFrOrigin with this distance value. The -9, -91 formula to compute is as follows: 12 . 728 -99, -991 140. 007 distFrorigin = V (x - 0)2 + (y - 0)2 OR [-999, -9991 1412. 799 3, 31 4. 243 distFrorigin = V x2 + y2 23, 23] 32.527 123, 123] 173.948 Note : V means square root 3) In Point2D class, getScalarValue () method is merely an accessor method that returns the value of attribute distFrOrigin. Point3D 4) In Line2D class, setLength () method computes the distance between its own Point2D attributes pt1 and pt2, and initializes the attribute length with this distance X Z Dist. Fr Origin value. The formula to compute is as follows: - - - -9, -9, -91 15. 589 length = V (pt1.x -

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Introduction to Wireless and Mobile Systems

Authors: Dharma P. Agrawal, Qing An Zeng

4th edition

1305087135, 978-1305087132, 9781305259621, 1305259629, 9781305537910 , 978-130508713

Students also viewed these Programming questions