C++辅导:COMS204 Enterprise 2D讲解留学生C/C++程序

- 首页 >> 其他

用C++实现平面上的关系处理,练习encapsulation, inheritance, polymorphism和overloading的编程设计。

Aim

The objectives of this assignment includes:

  • Learning about encapsulation, inheritance, polymorphism and function overloading
  • Apply the concepts learnt by developing a survey and path planning program

Background

Last time, in Assignment 1

“In a theoretical flat-land universe, everything is in 2 dimensions. People, animals, plants to planets, moons, galaxies and even space itself, is in 2D. In our flat-land space (i.e. ‘flat-space’), there is a powerful organization called 2D-StarFleet (2DSF), whose goals include seeking out new life and civilization via exploration.”

And now, the continuation …

While on a mission of exploration, the flagship of 2DSF, the Enterprise-2D is trapped in an expanse of space encircled by a massive ring of violent, electrical plasma storm. Data coming in from the sensor array reveals that the only opening in this storm is located at the far end of the enclosed area, from Enterprise-2D’s current location.

In addition, the sensor data also revealed that this area is populated by strange, 2D geometrical shapes, with sizes ranging from a small moon, asteroid, to large planets, or even a star! This implies that to travel to the ‘exit’ at the far end of the storm, you need to understand more about the properties of these shapes and attempt to chart a course to navigate to the exit!

As a Science Officer aboard Enterprise-2D, you need to develop a program that has the following capabilities:

  • a) read in sensor data on the strange 2D shapes (via manual input)
  • b) compute the area (‘mass’) of these shapes
  • c) print shapes report (e.g. list of points: on its perimeter, or totally within shape’s area)
  • d) sort shapes data (sorted by special type and area)

The next section provides information about the requirements for developing this program.

Task Requirements

  • A) In terms of relative positioning, you may assume a coordinate system with Enterprise-2D at the origin, trying to navigate in a general ‘upper-right’ direction, to get to the exit in the storm. Please refer to Appendix A, which elaborates on this coordinate system and the unit representation of 2D shapes.
    IMPORTANT : For this assignment, you should not assume that the 2D shapes in Appendix A are positioned exactly as shown in Appendix A, nor that there are not more shapes. There will, however, only be shapes of the types listed in Appendix B
  • B) The sensor data coming in from Enterprise-2D’s sensor array provides crucial information about the 2D shapes such as name, special type and location of all vertices (that outlines the perimeter of the shape). Please refer to Appendix B, which provides a more detailed description of the sensor data.
  • C) To assist you in the initial class design of your program, please refer to Appendix C, which illustrates one possible way of designing your program. It also describes a list of requirements which you need to implement, especially those marked under “compulsory”. The classes highlighted in Appendix C are purely meant to store data about the 2D shapes entered into your program by user.
  • D) You are required to implement a main driver class called ‘Assn2’, whose methods are called to start the program. When started, it should print a menu providing the following functionalities :
    • read in sensor data on the strange 2D shapes (via manual input)
    • compute the area (‘mass’) of these shapes
    • print shapes report (e.g. list of points on its perimeter, or totally within shapes area)
    • sort shapes data (sorted by special type and area)
  • E) 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.
  • F) You are to use only C++ language to develop your program. There is no restriction on the IDE as long as your source files can be compiled by g++ compiler (that comes packaged in Ubuntu linux) and executed in the Ubuntu terminal shell environment.

Deliverables

  1. The deliverables include the following:
    • a) The actual working C++ program (soft copy), with comments on each file, function or block of code to help the tutor understand its purpose.
    • 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/evaluation 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 E, which contains details about what to submit, file naming conventions, when to submit, where to submit, etc.
  3. The evaluation 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 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 presentation and satisfactory answers provided during Q amp; A session.
  • (iii) Additional effort (e.g. enhancing the program with relevant features over and above task requirements, impressive, ‘killer’ presentation, etc)
  • (iv) After the submission of deliverables, students will be required undergo an evaluation process (to determine fulfillment of task requirements.) Further instructions will be given by the Tutor during the subsequent respective labs. Please pay attention as failure to adhere to instructions may result in deduction of marks.