You are on page 1of 1

Reliable Software Systems

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 group members. 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 corresponding to the exercise can be downloaded from ILIAS. Please work on the provided project and submit the nished project as a zip le. Problem 1. Recapitulation of UML, Java and pseudocode [Points: 37] a) Impl (9 points) Given the following UML class diagram:
de.unistuttgart.dsaws2013.ex0.p1

Product
-name: String -description: String -price: int +<<constructor>> Product(name:String, price:int, manufacturer:Manufacturer) +getName(): String +setName(name:String) +getDescription(): String +setDescription(description:String) +getPrice(): int +setPrice(price:int) +getManufacturer(): Manufacturer +setManufacturer(manufacturer:Manufacturer)

Manufacturer
-name: String -street: String -city: String -country: String
0..* manufacturer +getName(): String 1 +setName(name:String) +getStreet(): String +setStreet(street:String) +getCity(): String +setCity(city:String) +getCountry(): String +setCountry(country:String)

Implement the illustrated classes in package de.unistuttgart.dsaws2013.ex0.p1 and provide a meaningful implementation for the constructor and all methods. There is no need to provide documentation for the classes in this case. b) Impl (18 points) Dene a Java enumeration called ProductFact in package de.unistuttgart.dsaws2013.ex0.p1 with 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 take a Product instance and a string as parameters and return a ProductFact value. The purpose of the method is to nd the given string in the string attributes of the product (and its manufacturer). If the string is found, the method should return the corresponding ProductFact value. Otherwise, it throws an IllegalArgumentException. 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

You might also like