- Objective: To implement a system indicative of a Farm environment
- Purpose: To demonstrate multi-inheritence design issues
- Prerequesites: A
UML
approved by an instructor.
- Consider a system in which
-
Eater
caneat
anEdible
object. -
NoiseMaker
canmakeNoise
-
Animal
is aNoiseMaker
andEater
Horse
is anAnimal
andRideable
Chicken
is anAnimal
and aProduce
whichyield
anEgg
.
-
Rider
canmount
anddismount
aRideable
object. -
Botanist
canplant
aCrop
in aCropRow
. -
CropRow
can store a single row ofcrop
. -
Field
can store manyCropRow
-
Vehicle
areNoiseMaker
andRideable
-
FarmVehicle
canoperate
on aFarm
Tractor
is aFarmVehicle
which canharvest
aCrop
.
-
Aircraft
areVehicle
which canfly
CropDuster
is aFarmVehicle
andAircraft
which canfertilize
aCropRow
-
-
Produce
canyield
anEdible
object depending on theirhasBeenFertilized
flag.Crop
is aProduce
which canyield
anEdible
object depending on itshasBeenHarvested
andhasBeenFertilized
flag.CornStalk
is aCrop
which canyield
aEarCorn
TomatoPlant
is aCrop
which canyield
aTomato
-
Person
canmakeNoise
and caneat
anEdible
object. -
Farmer
is anEater
, aRider
, aBotanist
, and aPerson
. -
Stable
stores manyHorse
. -
FarmHouse
stores manyPerson
-
ChickenCoop
stores manyChicken
-
Farm
stores manyStable
, manyChickenCoop
, and a singleFarmHouse
-
Froilan
, aFarmer
has aFarm
consisting of-
1
Field
of 5CropRow
.- Row 1 has
Corn
- Row 2 has
Tomato
- Row 3 and beyond grows arbitrary vegetation.
- Row 1 has
-
15
Chicken
across 4ChickenCoop
-
10
Horse
across 3Stable
. -
2
FarmVehicle
-
1
Aircraft
-
His sister,
Froilanda
, is aPilot
who uses aCropDuster
.
-
-
Create a test cases which simulate a typical work-week for
Froilan
andFroilanda
.- The accumulation of your test cases should ensure at least 80% test coverage.
-
The first few weekdays have already been considered for you.
-
Create a separate Test class for each day in the following scenario.
- As a farmer, Froilan must stick to a rigorous agricultural routine.
-
Every morning,
Froilan
andFroilanda
begin their morning by- Riding each
Horse
in eachStable
. - Feeding each
Horse
3 ear ofCorn
. - For breakfast,
Froilan
eats 1EarCorn
, 2Tomoato
, and 5Egg
.Froilanda
eats 2EarCorn
, 1Tomoato
, and 2Egg
.
- Riding each
-
Sunday
,Froilan
plants 3 different type ofCrop
in his first, second, and thirdCropRow
. -
On
Monday
, his sister,Froilanda
uses theCropDuster
tofly
over theField
andfertilize
each of theCropRow
-
On
Tuesday
,Froilan
uses hisTractor
tofertilize
eachCrop
in eachCropRow
.
-
- As a farmer, Froilan must stick to a rigorous agricultural routine.