DSA_Ex00

download DSA_Ex00

of 1

Transcript of DSA_Ex00

  • 8/14/2019 DSA_Ex00

    1/1

    Exercise Sheet 0

    Data Structures and Algorithms (WS 2013/14)

    Due: Mon, Oct 21, 2013, 10:00 a.m. Exercise session: Tue, Oct 22, 2013

    Maximum points: 37

    The exercise should be solved in groups of 3 persons and submitted to ILIAS as a PDF le by one of the groupmembers. The rst page of the PDF must contain names, student IDs and email addresses of all members.

    The exercise problems which include implementation are indicated by Impl . An Eclipse project correspondingto the exercise can be downloaded from ILIAS. Please work on the provided project and submit the nishedproject as a zip le.

    Problem 1. Recapitulation of UML, Java and pseudocode [Points: 37]

    a) Impl (9 points) Given the following UML class diagram:

    Implement the illustrated classes in package de.unistuttgart.dsaws2013.ex0.p1 and provide a mean-ingful implementation for the constructor and all methods. There is no need to provide documentationfor the classes in this case.

    b) Impl (18 points) Dene a Java enumeration called ProductFact in package de.unistuttgart.dsaws2013.ex0.p1with the following constants:

    NAME DESCRIPTION MANUFACTURER NAME MANUFACTURER STREET MANUFACTURER CITY MANUFACTURER COUNTRY

    Then, implement a class TextFinder with a single static method findText . The method should takea Product instance and a string as parameters and return a ProductFact value. The purpose of themethod is to nd the given string in the string attributes of the product (and its manufacturer). If thestring is found, the method should return the corresponding ProductFact value. Otherwise, it throws anIllegalArgumentException . The method should also check for invalid input parameters ( null ).

    Please also provide a Javadoc-compatible comment which describes the usage of the method findText .

    c) (10 points) Write a pseudocode of the method findText in the previous problem.

    1