The Assignment2
The Assignment2
Assignment 2 (7 marks + 1.5 + 1.5 bonus) – Version 1.0 Cairo University, Faculty of Artificial
Intelligence and Information
CS213: Programming II
Year 2022-2023
First Semester
Course Instructors:
Dr. Mohammad El-Ramly
Revision History
Version 1.0 By Dr Mohammed El-Ramly 26 Oct.2022 Main Doc
CS213: Object Oriented Programming
Assignment 2 (7 marks + 1.5 + 1.5 bonus) – Version 1.0 Cairo University, Faculty of Artificial
Intelligence and Information
Objectives
This assignment aims to learn OOP concepts in C++ and how to use OOP modeling and design
with C++ to build systems with intermediate complexity.
Instructions
1. Deadline is Tues 12th of November 2022 @ 11:59 pm. Weight is 7 marks + 3 bonus marks.
2. Students will forms teams of three students from the same lab/section.
3. Please submit only work that you did yourself. If you copy work from your friend or book
or the net you will fail the course. تسهيم حهىل منقىنة مه أي مصدر يؤدي إنً انزسىب فً هذا انمقزر
ال تغش انحم أو تنقهه مه أي مصدر و اسأننً فً أي شئ ال تفهمه نكه ال تنقم انحهىل مه اننت أو مه سمالئك أو أي مكان
Task 0 (0 marks)
1. Review OOP C++ concepts and syntax.
2. Create a private GitHub repo for the project and use it for development.
It is required to build a class BigReal. An object of this class represents a real number of an
arbitrary length. The public interface of your class will be as follows. For functions where default
implementation of C++ is enough and works fine, you do not need to re-implement them. Break
your code into: header file, implementation file and application file.
class BigReal {
private:
...
public:
BigReal (double realNumber = 0.0); // Default constructor
BigReal (string realNumber);
BigReal (BigDecimalInt bigInteger);
BigReal (const BigReal& other); // Copy constructor
BigReal (BigReal&& other); // Move constructor
BigReal& operator= (BigReal& other); // Assignment operator
BigReal& operator= (BigReal&& other); // Move assignment
BigReal operator+ (BigReal& other);
BigReal operator- (BigReal& other);
bool operator< (BigReal anotherReal);
bool operator> (BigReal anotherReal);
bool operator== (BigReal anotherReal);
int size();
int sign(); /
friend ostream& operator << (ostream& out, BigReal num);
friend istream& operator >> (istream& out, BigReal num);
};
You should make maximum possible use of the functions already in BigDecimalInt.
It is required to separate your design into a header file and an implementation file. You should also
validate that the passed parameter in case of string is a valid real number. Note that 1. and .1 are
valid real numbers but 1.1.1 is not valid real number.
Your new class will support writing application programs like this:
BigReal n1 ("11.9000000000000000000000000000000001");
BigReal n2 ("2333333333339.1134322222222292");
BigReal n3 = n1 + n2;
cout << n3;
n3 = n3 + BigReal (0.9);
Test your class with a small application and 12 test cases at least the test all these functions.
Team member with the smallest ID will do the first colored set of functions, the second will do the
second (+ and -) and the third will do the third.
What to deliver?
1- Written code in standard C++ not using third-party libraries. Put in a separate directory.
2- Name your file A2_Task1_YourGroup_YourIDs.cpp or .zip (if more than one file)
3- In the pdf report, include a detailed class diagram showing class, relations and attributes.
CS213: Object Oriented Programming
Assignment 2 (7 marks + 1.5 + 1.5 bonus) – Version 1.0 Cairo University, Faculty of Artificial
Intelligence and Information
What to deliver?
1- Working code in standard C++ not using third-party libraries in a separate directory.
2- Name your file A2_Task2_YourGroup_YourIDs.cpp or .zip (if more than one file)
3- In the pdf report, include the detailed class diagram showing classes, relations and attributes.
4- In the report, include a work break-down table showing who did which part.
Group Bonus 1: Task 3 (1.5 mark) – Static Code Analysis and Code Quality
Software is expensive to develop and is expected to live for several years. Many people over a long
period of time might have to work on the same program. It is extremely important, ethically,
professionally and economically, to develop high quality code.
In this task, it is required for all team to cooperate in using one of the static analysis and code
quality tools to analyze their solution for tasks 1 and 2. They can use student version of PVS studio
https://pvs-studio.com/en/order/for-students/ or anther tool they have access to, e.g. SonarCube. (A
video on PVS is here but there are many https://www.youtube.com/watch?v=vYW6TOwFK2M)
These tools look for weak and vulnerable parts of the code, bad practices, misuse of language
constructs and can enforce the application of coding style. (to some extent, for example, it
cannot decide for you if variable names are good, but it can check indentation and spacing)
Students will analyze the code with tool, find all important quality issues, and then fix them and
produce better code.
What to deliver:
1- A written report of the experience with the tool and how useful it is and easy / hard to use.
2- A list of the most important issues found (they can be 100s, only report the important ones)
3- A modified and clean version of the code.
4- A work break-down table explaining who did what in this part.
________________________________________________________________________________
Group Bonus 2: Task 5 (1.5 mark) – Code Generation
Writing code is a costly and time consuming job. Software design is an essential step before writing
code that involves specifying the different parts of the software, e.g., classes, database tables,
algorithms, etc. Any respectable software development team would do software design before
CS213: Object Oriented Programming
Assignment 2 (7 marks + 1.5 + 1.5 bonus) – Version 1.0 Cairo University, Faculty of Artificial
Intelligence and Information
starting coding. Would not be great if we can generate the code (even partially) from the
artifacts produced in design like class diagram?
Your task it to use a UML design tool (like MS Visual Paradigm https://www.visual-
paradigm.com/download/) to model the class diagram of your banking system of task 2 up to the
detailed level and generate the code for it. Then complete the code and run the app.
What to deliver:
1- A written report of the experience with the tool and how useful it is and easy / hard to use.
2- A comment of the quality of the code generated. Is it good quality? Is it clean / readable?
3- A working banking application that is generated from the tool.
4- A work break-down table explaining who did what in this part.
Submission Instructions
Team will submit into acadox the following:
1. A zip file with the following components.
2. A pdf report with the following items.
The document should have a cover page like this.
A screen shot for every GitHub account for shared projects.
The required class diagrams, work break-down tables and
reports needed in bonus tasks.
3. Team will create a project in GitHub to upload code there.
4. The source code of each program in a separate folder with suitable name for the folder. For
individual problems, each student should put his solutions divided into 2 folders, one for each
problem and folder name should have his name and ID.
5. Each team member will work individually on his part. But the team must provide ONE
integrated and working program and report.
6. Team members are expected to help each other but not do work of others.
7. Team members are responsible of testing all the programs and making sure they work.
8. All team members must understand the details of all programs and be able to explain it or
even modify it if needed. TA can ask any team member about any of the programs developed.
9. Ask your TA about the discussion time of your work.
Marking Criterion
1. 2.0 for developing your part in the group problem (Task 1) correctly.
2. 1.0 for integrating the code and developing one working program.
1. 1.0 for developing your part in the group problem (Task 2) correctly.
2. 1.0 for integrating the code and developing one working program.
3. 2.0 for developing a solution for the individual problems (Task 3).
4. -1 for not understanding the solutions of individual problems of others
5. 1.5 Group Bonus1 for checking code quality by the tool and producing a high quality report
6. 1.5 Group Bonus2 for producing high quality model and generating the banking system.