Faculty of Engineering

SEG 2105 Labs and Assignments (subject to change)

This page is obsolete. If you see it, please report to the professor The correct page for 2012 is this one.

For all of these assignments, see the official syllabus for master deadline dates and lab times. Note that these instructions and the dates are subject to change; any changes will be announced to students by email and/or on the course home page. Such announcements supercede anything shown in the syllabus.

Note: Answers to these questions will not, generally, be posted on the web in any form. This is necessary since students in other universities are also doing these exercises. The answers will, however, be discussed in detail by your lab TA, when the assignments are handed back.

Handing in assignments: Your TAs will give you instructions about how to hand in assignments. The TAs will deduct 10% for late assignments, plus 0.5% extra for every hour they are late, and will refuse to accept any that are handed in after the answers have been discussed in class.

Marking method and discussion of results: Your lab TA will mark the assignments and hand them back in the lab period. If you have complaints about the marking, please first discuss the problem with the TA who marked it. Only come to the professor once the TA has looked at an assignment and has written a comment on it that says he/she refuses to change it.

Rules on cheating and working together: The individual assignments must be done strictly on your own; you may only ask the TA for help. The group assignments must be done only with your partner and you must both share the design, programming and writing work. Any sharing or copying of any part of your work with others will result in an immediate 5% penalty on your final course grade as well as zero on the assignment. TAs will be instructed to immediately report any cheating to the professor. As an additional disincentive to cheating, midterm and exam questions will relate to the labs and assignments.


Lab 1 started in the first lab (and assignment 1)

Lab date: Mon Sep 12 2010 or Thurs Sep 15 2011

This will be handed in as assignment 1, by 5 p.m.on Fri Sep 23 2010.

Group work and partners: In this lab, and all other labs that involve programming, you will work in groups of two. If you have not previously arranged to work with someone in your lab section, then you will have to find someone immediately. If there are an odd number of students, the TA may permit an individual to work alone for now. No groups of 3 will be permitted.

Seating: In the early labs, each group will use one computer, although you will need an extra computer when you are doing later labs involving client-server work.

Saving work and accounts: Your TA will give you any needed help regarding setting up your account. Before you leave the lab each day, make sure you have saved your work.

Using Eclipse: You will be using Eclipse in this lab. Instructions on how to get started in the lab can be found here.

Exercises to do: Work on the following exercises from the textbook. You must hand in only one copy of answers per group. Make sure the names and student numbers of both partners are clearly indicated. You must work on these questions during the lab and then finish off the work on your own time.


  1. Before coming to the lab you were asked to read and understand Section 2.9 of the textbook, starting on page 57. If you have not done this, take five minutes now to do it.

  2. To start this lab, download the code for the PointCP example available at http://www.site.uottawa.ca/school/research/lloseng/supportMaterial/source/.
    Compile the code and run it.

  3. By modifying the original version, implement both design 3 (Cartesian points only) and design 4.(both types of points stored) When you hand in the lab, you will hand in the code you have written.

  4. Modify the PointCPTest class to allow you to test the designs you have developed. Do a thorough series of tests to ensure your classes and interface work properly. You will hand in the code, and also a printout of the output generated by your tests.

  5. Hand in your answers to exercises E26 (table of what you think will be the advantages and disadvantages of each design), and E28-E30 (performance analysis, comparing Design 2 with Design 5, instead of Design 1 with Design 5 as the book says). Hand in a description of how you did the tests, sample outputs from running the tests, the table and a discussion of the results.

    Hint: To measure execution time of a method, you can execute it many thousands of times, and then find the elapsed time in milliseconds. You should execute each design enough times so the program takes about 10 seconds to run. Look in the Java documentation for the currentTimeMillis() method. To test two different designs you can simply run the code, timing the results for the first design. Then edit the code to use the new class (and constructor), and compile and run it again. We suggest you run each version several times to ensure that your results are consistent. If they are not consistent, take the median result as your definitive result and list the other results..


Assgnment 2

Due Oct 7, 2010, 5 p.m.. This is an individual assignment. You must work strictly alone on this.

Hand in answers to the following. It is suggested that you do the questions from Chapter 2 by October 1, and do the question from Chapter 5 around Oct 4 after we have covered the material in the lectures

  1. E5 (page 35), parts b and f

  2. E6 (page 36), part c

  3. E7 (page 37), parts c and d

  4. E9 (page 39), part c

  5. E12 (pages 43-45), parts e and h

  6. E15 (page 50), part b

  7. E18 (page 51), parts b and e

  8. E45 (page 81), part b

  9. From Chapter 5: Create a class diagram for the following system. Show classes, associations and generalizations: You are in charge of the website of a community. Residents in the community can sign up to join the community association for a fee of $30. If they do, then they can vote for the executive of the association and can use facilities and attend certain events for free. Only one membership is required per residence and it must be renewed by the end of October each year (it is valid for one year). For each member the system stores the street address, apartment number (if there is one) the email address, the telephone number, and the names of the residents. Anyone under 18 is flagged, as there are special events for these people. The community runs a rink in the winter and three tennis courts in the summer. Members of the community association are given priority to sign up for blocks of time in these facilities, to a maximum of four hours per week. Residents who are not members can sign up 24 hours before their booked time, if there are still any free time slots. When a non-member signs up in this way, they need to give their name, street address and email address. Some time slots in the rink and tennis courts are left unbooked for free 'first-come-first-served' access'.


Lab 2 and 3 (and assignment 3)

Lab dates: Mondays Sep 19/26 or Thursdays Sep 22/29 2011.

This will be handed in as assignment 3, by 5 p.m.. on Oct 14, 2011.

Instructions for setting up the OCSF and SimpleChat code in Eclipse are found here: href="http://www.site.uottawa.ca/~tcl/seg2105/coursenotes/Lab2_Getting_Started.html.

Note you have a reasonably long amount of time to do this; I suggest you get as much as you can done in the lab period during the first week and second week, and then start working on it as homework so that the final week you are only asking the TA some leftover questions.

Group work and partners: For this lab, you may have a different partner from the one you had for the first lab, but please only do so after discussing with your TA and your previous partner, so we don't end up with partners that are stranded. In other words, do not abandon your partner without ensuring your partner has someone else to work with. You must work with the same partner from this point onwards in the course, unless your partner drops the course.

Purpose of the lab These lab questions are designed to help you become very familiar with the design of the SimpleChat program and the OCSF framework. You should read the relevant sections of the textbook before coming to the lab. You will be tested on your understanding of SimpleChat and OCSF in the midterm.

Exercises to do: You will do exercises listed below from pages 104-107 of the textbook with a few modifications to ensure that the work you do is a little different from the work of last year.

  1. E48, page 104 (5 marks): Do only testcases 1001 to 1009. Hand in a statement listing the test case number and 'Success: Results as expected' or 'Failure: results .....'

  2. E49, pages 104-105 (25 marks): Hand in changes to your code with each preceded by a comment so the TA can see what you changed for this question. Your comment should look something like this '// **** Changed for E48' and your initials. Furthermore, add normal code comments explaining anything non-obvious in what you are doing.

  3. E50, pages 105-106 (30 marks): As before, comment each change as you go.

  4. E51, pages 106-107 (30 marks): As before, comment each change as you go.

  5. E52, page 107 (10 marks): Hand in a statement listing the test case number and 'Success: Results as expected' or 'Failure: results .....' If you have bugs in your code that result in failed testcases, you will still get marks here. You will lose marks, however, if your results are 'faked' in any way.

What to hand in: Hand in the following: 1) A document containing the test cases for E48 (1001 to 1009) and E52. 2) Your entire simplechat *directory* (DO NOT submit the OCSF framework directory). Following the additional instructions from your TA.


Lab 4, UML and Umple.

Lab dates: Monday Oct 3 or Thurs, Oct 6, 2011.

The Umple lab instructions are online at this location. This is a Word file, since I want you to be able to cut and paste some code, while preserving the indentation. Open the file and then use a web browser and Eclipse as you work your way through the lab.

There is no lab report for this lab, however attendance will be taken, and a mark will be given for this if you show the TA your results when the instructions tell you to.


Assgnment 4

Due Nov 1, 2011, 17:00. This is an individual assignment. You must work strictly alone on this.

Create a class diagram for the following system.

You are creating a software system to be used by independent garages, where mechanics fix cars and light trucks.

The first part of the system will be a large data store that contains information about most common vehicles, as obtained from the manufacturers and others. Each vehicle type has the following information: Its manufacturer, model year, model name, and trim line name. There is list of part types that are used in vehicles of many kinds (e.g. battery, sumer tires, winter tires, spark plugs, interior mirror, etc.). These are organized in a part-of hierarchy to facilitate browsing (e.g. spark plugs are part of the engine). Next, there is a list of specific products that can be purchased and installed in vehicles. The system tracks which part types are allowed to be installed in which vehicle types. For example a certain model of Toyota RV4 might allow only certain battery types to be installed.

The final component of the system is the part that tracks specific vehicles, customers and work performed. Customers can bring in their vehicles for repairs. The system must track the various work done and the parts that are purchased and installed in each vehicle. It is up to you to refine the requirements for this part of the system.

You should consider using UmpleOnline to create your model. You may hand in both the Umple textual code and a picture of the diagram. If you want, however, you can use a different UML tool.

Show all associations, attributes and generalizations.


Assgnments 5 and 7

For these assignments, you will develop a very simple application of your choice. The application will build on top of OCSF and also involve implementing a few classes from a UML diagram. You will have clients that can send commands to the server.

The server responds to the commands in some way. The server will likely also have to send commands/acknowledgements back to the client. You can either also create a simple graphical user interface for the clients or else make a simple textual UI, but add some other feature of your choice in the server. The TA will judge your work based on quality, amount of work, and innovative ideas.

You can assume that all the data will simply be saved in the memory of the server (i.e. Java objects. I.e. you will not need to worry about making the data persistent, although if you do that (e.g. using Java persistence, then you will get a 1-point bonus on your overall course assignment component).

Here are some examples of basic, reasonably straightforward applications:

For assignment 5, do the following:

  1. Create requirements showing the problem statement as well as the functional, quality and platform requirements for your system. This ought to be between 2-5 pages. See examples in the textbook.

  2. Create a UML diagram of the data you will need to store.

  3. Design the commands that the server and client will understand to implement the requirements. This will probably be between 2 and 4 pages. See examples in the textbook.

  4. Explain how you will divide the work amoung the members of your team, and how much time you expect each task to take.

Assignmemnt 5 is due 5 p.m. Friday Nov 11 2011.

For assignment 7, do the following:

  1. Implement and get your system running. You may use Umple. You will demo this in the labs (dates to be determined later). The TA will schedule a time slot for each group. If bugs occur in the demo you can fix them for the final submission.

  2. Hand in your implementation, as well as revised versions of what you changed from Assignment 5 (i.e. as you discovered bugs).

Assignment 7 is due 5 p.m. Fri Dec 2 2011


Assgnment 6

This is an individual assignment. You may not work together.

Please hand this in by 5 p.m. Fri Nov 25 2011.