Oodj Test1
Oodj Test1
Oodj Test1
Questions 1 (1 mark)
a) 3
b) 321
c) 123
d) The code runs with no output
Questions 2 (1 mark)
Which Man class properly represents the relationship “Man has a best friend who is a
Cat”?
Questions 3 (1 mark)
The image represents a complete package structure for a set of classes: “com” is the
beginning of the fully qualified package name for all classes.
Given this package structure, insert the code needed to make the car class compile and
run successfully. All the three placeholders must be filled. If fewer than three
statements are needed, use the “//blank” option.
a) package com.foo.bar.blatz;
package com.bar.*;
import com.foo.bar.Book;
b) package com.bar.*;
import com.foo.bar.*;
import com.foo.bar.blatz.*;
c) import com.foo.bar.blatz.*;
package com;
//blank
d) import com.bar.*;
import com.foo.*;
package com.foo.bar.blatz;
Questions 4 (1 mark)
a) TestA
b) TestB
c) TestA
TestB
d) TestB
TestA
Questions 5 (1 mark)
a) Transform the given diagram to Customer and Account Java classes with
appropriate constructors.
b) Illustrate how to create a Customer object with name “Joseph” is having an
Account with id of 12345 and balance of 500.0 by completing the following
Testing program.