Download as xlsx, pdf, or txt
Download as xlsx, pdf, or txt
You are on page 1of 5

Animal (Abstract) Cat

# id: String (Axxx-yyyy) - price: int


# name: String ( Non blank) + Cat():

+
Cat(price:int,name:String,ag
e:int,gender:String,breed:St
# age: int (>0) ring)
# breed: String +favorite()

+ getters + setters +talk()


+ toString():String

Inputter

Main
main

Menu
Dog AnimalManager extends ArrayList<Animal>
- price: int +loadFromFile(filePath:String):void
+ Dog(): +saveToFile(filePath:String):void

+
Dog(price:int,name:String,age:in +addPet(): Enter information and add a pet into
t,gender:String,breed:String) the list
"Sleep" +favorite() "Run" +searchByID(String ID):Animal

"Meow Meow" +talk() "go go" +modify(String ID): Sua thong tin theo id
+sortByID(asc:boolean)
<<Behavior>> +sortByName(asc:boolean)
+favorite() +sortbyPrice(asc:boolean)
+talk() +printByType(type:String)
+removeByID(ID:String): remove bang ID
+removeByID(ID:String): remove bang ID
+removeByType(Type:String): remove bang ID
+printAll()
+calcPrice()
AnimalManager
- Animal[] list;
- int MAX_LEN = 100, numOfItem=0;

+loadFromFile(filePath:String):void
+saveToFile(filePath:String):void
+addPet(): Enter information and add a pet
into the list
+searchByID(String ID):Animal
+modify(String ID): Sua thong tin theo id
+sortByID(asc:boolean)
+sortByName(asc:boolean)
+sortbyPrice(asc:boolean)
+printByType(type:String)
+removeByID(ID:String): remove bang ID
+removeByID(ID:String): remove bang ID
Input num of cat & dog and calculate price +removeByType(Type:String): remove bang ID
+printAll()
+calcPrice()
Cats.txt id Age Name breed Price
A000-1900 3 Lyly Long Vang 1000
A000-1901 3 Miu Tam the 1500
A000-1902 3 May Meo Anh 2000
A000-1903 3 Mua Long Den 2500
A000-1904 3 Mua Ai cap 3000

Dogs.txt id Age Name breed Price


addPet 1 No copy --> 0
modify 1
sorts 1
searchs 1
prints 1
price 1
removes 1
trinh bay 3

You might also like