0% found this document useful (0 votes)
193 views1 page

Exercise: Object Oriented Analysis & Design Lab # 8

This lab aims to help students understand static and dynamic object modeling by having them draw a UML class diagram and sequence diagram for a given program. The program contains a Driver class with a main method that runs the run method, which initializes a StringContainer object and calls its add and remove methods. The StringContainer class contains a Vector to store Strings and has init, add, and remove methods.

Uploaded by

Sonu Sachdev
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
193 views1 page

Exercise: Object Oriented Analysis & Design Lab # 8

This lab aims to help students understand static and dynamic object modeling by having them draw a UML class diagram and sequence diagram for a given program. The program contains a Driver class with a main method that runs the run method, which initializes a StringContainer object and calls its add and remove methods. The StringContainer class contains a Vector to store Strings and has init, add, and remove methods.

Uploaded by

Sonu Sachdev
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

Object Oriented Analysis & Design

Lab # 8

The objectives of lab 8 are to:


• Understand the and implement static object modelling and dynamic object modelling

Exercise
Task 1: Draw an UML class diagram to express the structural relationships in the following
program and draw an UML sequence diagram to express the dynamic behavior.

import java.util.Vector;

public class Driver {


private StringContainer b = null;

public static void main(String[] args){


Driver d = new Driver();
d.run();
}

public void run() {


b = new StringContainer();
b.add("One");
b.add("Two");
b.remove("One");
}
}

class StringContainer {
private Vector v = null;

public void add(String s) {


init();
v.add(s);
}

public boolean remove(String s) {


init();
return v.remove(s);
}

private void init() {


if (v == null)
v = new Vector();
}
}

You might also like