Вы находитесь на странице: 1из 4

Institute of Management Studies Subject: OOPs

Semester: IV (A)

Tutorial Sheet 1 Q.1. Prepare a class diagram from the instance diagram in following figure.

Q.2. Prepare a class diagram from the instance in following figure. Explain your multiplicity decisions. Each point has an x coordinate and a y coordinate. What is the smallest number of points required to construct a polygon? Does it make a different whether or not a given point may be shared between several polygons? How can you express the fact that point are in a sequence?

Q.3. Consistent with the object diagram that you prepared in Q.No. 2, draw an instance diagram for two triangles with a common side under the following conditions: a. A point belongs to exactly one polygon. b. A point belongs to one or more polygons Q.4. Prepare a class diagram from the instance diagram in following figure. Explain your multiplicity decisions. How does your diagram express the fact that points are in a sequence?

Q.5.Prepare object diagrams showing at least 10 relationships among the following object classes. Include associations. Aggregations and generalizations. Use qualified associations and show multiplicity balls in yours diagrams. You do not need to show attributes or operations. Use association names where needed. As you prepare the diagram, you may add additional object classes. Created By: Vipin Kumar Jai Shani Dev

a. School, playground, principal, school, classroom,, book, student, teacher, cafeteria, restroom, computer, desk chair ruler door, swing. b. Castle, moat, drawbridge, tower, ghost, stairs, dungeon, floor, corridor, room, window, stone, lord, lady, cook. c. Expression, constant, variable, function, argument list, relational operator, term, factor, arithmetic operator, statement program. d. File system, file, directory, file name, ASCII file, executable file, directory file, disk drive, track, sector. e. Automobile, engine, wheel, brake, brake light, door, battery, muffler, tail pipe f. Gas furnace, blower, blower motor, room thermostat, furnace thermostat, humidifier, humidity sensor, gas control, blower control, hot air vents. g. Chess piece, rank, file square, board, move, position, sequence of moves h. Sink, freezer, refrigerator, table, light, switch, window, smoke alarm, burglar alarm, cabinet, bread, cheese, ice, door, kitchen Tutorial Sheet 2 Q.1 Categorize the following relationship into generalization, aggregation, or association. Beware, there may be ternary or n-ary associations in the list so do not assume every relationship involving three or more object classes is a generalization. Defend your answers. a. A country has a capital city. b. A dining philosopher is using a fork. c. A file is an ordinary file or a directory file. d. Files contain records. e. A polygon is composed of an ordered set of points. f. A drawing object is text, a geometrical object, or a group. g. A person uses a computer language on a project. h. Modems and keyboards are input/ output devices. i. Object classes may have several attributes. j. A person plays for a team in a certain year. k. A route connects two cities. l. A student takes a course from a professor. Q.2.Prepare an object diagram for graphical document editor that supports grouping, which is a concept used in a variety of graphical editors. Assume that a document is composed of several sheets. Each sheet contains drawing objects, including text, geometrical objects and groups. A group is simply a set of drawing objects, possibly including other groups. A group must contain at least two drawing objects. A drawing object can be a direct member of at most one group. Geometrical object include circles. ellipses, rectangles. Lines and squares. Q.3. A directory file contains information about files in a directory, including both ordinary files as well as other directory files. Prepare an object diagram which models directory files and ordinary files. Since a directory plus a file name uniquely identifies a file, you will probably want to use file name as qualifier. Q.4. Following figure is a portion of a met model which describes generalization. A generalization is associated with several generalization roles, which are the roles that object classes play in generalization relationships. Role type is either subclass or superclass. Does this model support multiple inheritances? Explain your answer. Created By: Vipin Kumar Jai Shani Dev

Generalization Discriminator

Generalization role role type

Object class class name

Q.5. Prepare a portion of an object diagram for a library book checkout system that shows the date a book is due and the late charges for an overdue book as derived objects. Tutorial Sheet 3 Q.1. Write scenarios for the following activities: (a.) Moving a bag of corn, a goose, and a fox across a river in a boat. Only one thing may be carried in the boat at a time. If the goose is left alone with the corn, the corn will be eaten. If the goose is left alone with the fox, the goose will be eaten. Prepare two scenarios, one in which something gets eaten and one in which everything is safely transported across the river. (b.) Getting ready to take a trip in your car. Assume an automatic transmission. Dont forget your seat belt and emergency brake. (c.) An elevator ride to the top floor. (d.) Operation of car cruise control. Include an encounter with show moving traffic that requires you to disengage and then resume control. Q. 2. The direction control for some of the toy electric trains was accomplished by interrupting the power to the train. Prepare state diagram for the headlight and wheels of the train, corresponding to the following scenario. Power is off, train is not moving. Power is turn on, train moves forward and train headlight shines. Power is turn off, train stops and headlight goes out. Power is turn on, headlight shines and train does not move. Power is turn off, headlight goes out. Power is turn on, train runs backward with its headlight shining. Power is turn off, train stops and headlight goes out. Power is turn on, headlight shines and train does not move. Power is turn off, headlight goes out. Power is turn on, train runs forward with its headlight shining. Q.3. A simple digital watch has a display and two buttons to set it, the A button and the B button. The watch has two modes of operation, display time and set time. In the display time mode, hours and minutes are displayed, separated by a flashing colon. The set time mode has two submodes, set hours and set minutes. The A button is used to select modes. Each time it is pressed the modes advances in the sequence: display, set hours, set minutes, display etc. Within the sub modes, the B button is used to advance the hours or minutes once each time it is pressed. Buttons must be released before they can generate another event. Prepare a state diagram of the watch. Q.4. Describe the meaning of the data flow diagram in following figure.

Created By: Vipin Kumar

Jai Shani Dev

Q.5. Prepare a data flow diagram for computing the volume and surface area of a cylinder. Inputs are the height and radius of the cylinder. Output is volume and surface area. Discuss several ways of implementing the data flow diagram.

Created By: Vipin Kumar

Jai Shani Dev

Вам также может понравиться