CSE2305 - Object-Oriented Software Engineering
assessment

 

Assignment 1.


This assignment is due before 11.59pm Friday, August 11, 2006 ( ).
Total marks: 50.
Contribution to final mark: 5%.

Synopsis


Note:

In order to compile and run C++ programs you should use g++, not gcc.


Question 1

[10 marks]

Examine the C++ source code in the files List.h, List.cpp and main.cpp (download them from here – a gziped tarball).

  1. Create a Makefile that has targets to build an executable and to remove any intermediate files.

  2. Explain what the code does and how it works. In particular, explain the purpose of the List::Node class¤.

  3. Using gdb, trace the execution of the code and verify your explanation (you don't have to submit this).

  4. To reinforce and preserve your new understanding, comment the code.


Question 2

[10 marks]
  1. As provided, the List class¤ has no destructor¤. Explain why a destructor¤ is needed.

  2. Write a suitable destructor¤ for class¤ List. (Make it as simple as possible. There is no need to write any functions other than the destructor itself.)


Question 3

[10 marks]


Question 4

[10 marks]
    1. Write a member¤ function List::InsertSorted(const DataType& data) that inserts a new element in the list in the correct place to maintain lexicographical (dictionary) order.

      Assume that the exisiting list into which you are inserting the data is sorted. Have a look for the lexicographical_compare() and toupper() functions. Note that you will need to consider what happens to capitalised words when you insert them.

    2. Add a new instance of List (call it sortedList) to main(). Use your new InsertSorted routine to add each of the words read in from the user to this new list. Print out the words from the new list.


Question 5

[10 marks]

Use the UML graphic notation to draw a class diagram of the final version of your List class.


What to submit for assessment

You should submit the following:

See the submit page for details on how to submit your assignment. Please make sure all files you submit contain this student declaration which attests that your submission is your own work.


This material is part of the CSE2305 - Object-Oriented Software Engineering course.
Copyright © Jon McCormack, 2005, Alan Dorin 2006. All rights reserved.

Last Modified: August 9, 2006