Class composition, C’tors, D’tors, static, const, reference, private, public, this
Download 24.83 Kb.
|
Assignment OOP 2022-2023-Rational-Polynomial-A (4)
- Bu sahifa navigatsiya:
- YOU SHOULD NOT USE A CLASS A MONOM TYPE! THE POLYNOMIAL CLASS SHOULD NOT HAVE ANY OBJECT OF ANY OTHER CLASS! Submission Requirements
Exercise Topics included: Class composition, C’tors, D’tors, static, const, reference, private, public, this. In this exercise you’ll be working with rational numbers of polynomials with one variable “x”. A polynomial is a sum of a number of monomials (the terms of the polynomial). Example: A polynomial example can be: 1 +x2 − 2 · x ·p(x)=3 A rational number example (with polynomials): Every polynomial will be represented as an instance of the Polynomial Class. Every instance of the Polynomial type is defined by its “maximum degree”. In the above example, the polynomial can be represented by an instance of degree 2 and above. A rational number (an instance of Rational Class) should be represented by two Polynomials (which represent the “numerator” and the “denominator”). In the moodle there’s a file called “Main.cpp”. This file shouldn’t be changed during your development. Design and develop the necessary classes (Polynomial and Rational) and split their declaration and definitions in the next files (polynomial.h, polynomial.cpp, rational.h, rational.cpp). After development of the project is complete execute the program (with the “main.cpp” file and compare that the results you get are exactly as they appear in the attached “result.jpg” file). Additional requirements: Avoid code duplication. The degree of the polynomial can’t be changed once the object has already been created. That’s why this degree should be defined as “const”. Use “const” and “references” in their corresponding places. The “Polynomial” class should store the “maximum degree” of all the polynomial objects defined. This value should be printable at any point in time. YOU SHOULD NOT USE A CLASS A MONOM TYPE! THE POLYNOMIAL CLASS SHOULD NOT HAVE ANY OBJECT OF ANY OTHER CLASS! Submission Requirements The submission should not include any other files except the “.h” and “.cpp” files that you’ve developed. The submission should be just 1 ZIP file including these relevant files. The assignment can be done in pairs (2 students at most!). If you submit in pairs, one student shall upload a ZIP file with all necessary content and the other student should upload a TXT file with the name of the partner. Similar/Copied submissions will be check and may get disqualified. Notes: Go over the material learned and practiced in classes. Ask questions if any assistance is required. Have fun! :) Download 24.83 Kb. Do'stlaringiz bilan baham: |
Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©fayllar.org 2024
ma'muriyatiga murojaat qiling
ma'muriyatiga murojaat qiling