You are on page 1of 3

CS 214 – Data Structures – 2nd Semester 10/11 – Assignment 1

Cairo University, Faculty of Computers and Information


CS 214 – Data Structures
Assignment 1 (3+1 %) – 2nd Semester 10/11 – Dr. M. El-Ramly
Start Date: 25 March 2011 Due Date 5 April 2011 Marking
Between 5 – 15 April

Objectives
1. Refresh C++ programming skills necessary for data structures course.
2. Review important C++ concepts.

Setup
1. This is a pair-assignment, that is to be solved by students in groups of two. Every pair are
required to provide evidence for their cooperation, e.g., a photo of them working together, an audio
recording of their conversations, a video of their group work, or anything else.
2. Every pair of students should register their names with their lab TAs.
3. The assignment consists of two problems and a bonus part.
4. You need to start working yesterday. If you wait till tomorrow, it might be late to finish
and submit.
5. Read the assignment very carefully so you do not miss any details or requirements.
6. Students work submitted for marking should be original. It is not permitted to submit a
solution taken from the net, from a book, from other students or any other source. It is not permitted to
give your work to other students to submit. Violations of academic honesty will be severely punished.
7. Students who are carrying CS214 from previous years, who studied it in Java, can solve the
assignment in Java.

Assignment Description

Problem 1: Fractions Calculator

In this assignment, you will develop an application for performing calculations on fractions.
1. First, develop a class Fraction that represents a fraction by one integer divided by another,
e.g., 1/3 or 3/7.
• This class defines adding, subtracting, multiplying, dividing and comparing (<, >, ==, <=
and >=) fractions by overloading the standard operators for these operations.
• It should also contain a function for reducing fractions. For example 2/6 is reduced after calling
the function to 1/3, etc.
• You also need to overload I/O operators to be able to input and output fractions naturally.
2. Separate class specifications from implementation by creating Fraction.h for specs and
Fraction.cpp for implementation.
3. Second, develop a class FractionCalculator that utilizes the class Fraction and
allows the user to input a fraction and perform calculations by adding, subtracting, etc. another
fraction and then keeping the result as a fraction for further calculations. The calculator always keeps

1
CS 214 – Data Structures – 2nd Semester 10/11 – Assignment 1

the most recent result and allows performing operations on it, including comparing it with a new
fraction.

Problem 2: Matrix Calculator

In this assignment, you will develop an application for matrix calculations.


1. It is required to design and implement a generic class Matrix, in the form of a class template
that accepts a type parameter. This way, when the class Matrix is instantiated, we decide if it
should accept float, int or double, etc.
2. Matrix class is able to hold a matrix of any size and allocate the required memory as needed.
3. Matrix class should have a destructor that frees used memory at the end of lifetime of each
Matrix objects.
4. Matrix class specifications should be in a separate header “.h” file.
5. It should have a pointer to pointer attribute that points to the matrix content. It should have
suitable constructors and methods for allocating the required memory space based on the
dimensions decided by the user.
6. Overload standard operators and I/O operators to enable Matrix class with addition,
subtraction and multiplication and suitable input and output capabilities. Add a method for matrix
transpose.
7. The develop a MatrixCalculator class which offers the user a menu of operations to
perform on int matrices as follows. Each of these options should be able to accept matrices of
varying dimensions, which the user inputs. For multiplication, the calculator should check that two
matrices are of dimensions n x m and m x p.
Welcome to (Your Name) Matrix Calculator
----------------------------------------

1- Perform Matrix Addition


2- Perform Matrix Subtraction
3- Perform Matrix Multiplication
4- Matrix Transpose

Bonus (1 mark)
Students can obtain one extra mark by implementing a graphical user interface for their applications
using Qt or any other graphical user interface library.

Coding Instructions
1- Students can use any C++ IDE they like but they must write their programs in standard C++,
unless they are using Qt for graphical user interface.
2- Students must write enough comments in the program to explain its functionality.
3- Students must user proper C++ coding style and naming convensions.

Submission Instructions
1- Each student will submit their solution in one zip file, named TA-A1-ID1-ID2.zip, where TA is
the abbreviation of the name of the TA teaching you as comes below and ID1 and ID2 are the IDs of
the students in FCI. It should include a report with the following items:

2
CS 214 – Data Structures – 2nd Semester 10/11 – Assignment 1

a) A cover sheet that includes:


Course code, course name, academic year, semester, instructor, assignment #, students names, IDs and
emails, etc.
b) The header files of Fraction and Matrix classes.
c) Evidence that the students worked together.
2- The zip file should also include two directories with your programs, one for fractions calculator
and one for matrix calculator.
3- Both students should create rcampus accounts to be able to receive their marks.
4- One student only need to upload the assignment in rcampus before deadline.
5- TA Abbreviations: Walid Fouad (WF), Marwa Nabil (MN), Sara Madaawy (SM), Sara Hassan
(SH), Nouran Hesham (NH), Mona Elkalamawy (ME), Desouki Abdelkawy (DA), Aya Albeely (AA),
Islam Yousri (IY), Basheer Abdelfattah (BA), Elsyed Hassan (EH).

Discussion Instructions
1- Your TA will determine your discussion time within one week from submission.
2- Both group members must attend to get the mark.
3- Bring a printed copy of the report with you to the discussion meeting, and preferably, a laptop with
your code up and running.

Assessment Criterion
The weight of this assignment is 3 marks + 1 bonus mark, divided according to the following:
1- 1.5 mark for Fractions Calculator
2- 1.5 for Matrix Calculator
3- 1 mark bonus for GUI
4- - 0.3 mark for lack of good programming style and comments.
5- - 0.3 mark for lack of softcopy or hardcopy of the report or report content or cover page.
6- - 0.3 mark for improper file naming
7- - 0.3 mark for not providing evidences of working together and cooperation.
8- - 0.3 for not using templates in problem 2.
9- - 3 marks for cheating.

Policy on Plagiarism ‫)السياسة المتبعة إزاء الغش )إقرأ جيدا جدا‬


:‫تتبنى كلية الحاسبات و المعلومات سياسة صارمة تجاه المانة العلمية و الغش و تشمل ما يلى‬
.‫تشجع الكلية على مناقشة الفكار و تبادل المعلومات لكن تبادل الحلول غير مقبول و يعتبر غشا‬ .1
.‫تستخدم الكلية برامج متطورة لمقارنة الملفات ببعضها و بالمصادر الموجودة على النت سهولة اكتشاف الغش‬ .2
‫أى حل يتشابه مع أى حل آخر بدرجة تقطع بأنهما منقولن من نفس المصدر سيعتبر أن صاحبيهما قد قاما بالغش من‬ .3
.‫بعضهما و ستطبق عليهما جميعا العقوبات أسفله بغض النظر عمن غش ممن‬
.‫توجد على النت برامج كثيرة مشابهة لما هو مطلوب هنا و أى نسخ من على النت يعتبر غشا يحاسب عليه صاحبه‬ .4
.‫إذا لم تكن متأكدا أن فعل ما يعد غشا فلتسأل المعيد أو أستاذ المادة‬ .5
‫فى حالة ثبوت الغش سيأخذ الطالب سالب درجة المسألة و سيتم إعادته بواسطة آلة الزمن إلى عهد الرئيس مبارك‬ .6
.‫لمدة أسبوع‬
.‫و فى حالة تكرار الغش سيرسب الطالب فى المقرر و يرفع أمره للكلية لتطبيق عقوبات مناسبة‬ .7

You might also like