您的位置:寻梦网首页编程乐园Java天地Core JavaJava Lecture Notes

Introduction

Content

Apply

Reflect

Extend

previous.gif
 (3087 bytes)

next.gif
 (2959 bytes)

 

Apply Index

Apply Page # 11

Exercise 8 — English-to-UML

The following text describes the inheritance relationships between a small number of types of animal. 
"Reptiles and mammals are types of animal. Snakes and tortoises are types of reptile. Dogs, cats and platypuses are types of mammal. All reptiles are types of `egg-laying animal', as are platypuses. Dogs and cats are types of `furry animal'. Tortoises are types of `animals with shell. "

Write Java 'class' and 'interface' definitions that embody the inheritance relationships described. For example, the fact that `cats are types of mammal' can be represented as: 

class cat extends mammal 
  {

  }

You are advised to make a UML diagram showing the inheritance relationships between these classes. You must avoid multiple inheritance by defining some interfaces.

Discussion of Exercise 8
Back to content

Back to top

  basicline.gif (169 bytes)

RITSEC - Global Campus
Copyright ?1999 RITSEC- Middlesex University. All rights reserved.
webmaster@globalcampus.com.eg