Uploaded by arcoppola

Create Your Own Virtual Pet (1)

advertisement
AP Computer Science A
Create Your Own Virtual Pet
(10 pts.)
You have been hired by ProgramsRUs. They would like for you to write a java
program for a Virtual Pet.
1. Write a java program to create an Animal class. (1 pt.)
(For example, my class would be Animal.java.)
In this program, write general methods that any animal can do.
(My methods would be eat(), sleeping(), excretes(), etc.)
2. Then, create another Pet java class to inherit these characteristics from the
Class you created in step #1 and write methods for a pet. Try out the “super”. (1.5
pts.)
(My class would be called Dog.java. My methods would be bark(), eat() and
play(), etc.)
3). Then, create another Pet java class to inherit these characteristics from the
class you created in step #2. (1.5 pts.)
(My class would be called BoxerDog.java. My methods would be bark(),
slobber(), and jump().)
***Create instance variables and use them.***
4. Write a java program (i.e. Adogslife.java) to actually create a Pet and
have the Pet actually do things. (3 pts.)
(i.e. Dog tyson = new Dog(); This creates new adopted dog, Tyson.
Then, I could have my new dog do the following:
tyson.eat();
tyson.excretes();
tyson.bark();
Put this in a menu:
For example:
1 – Feed dog.
2 – Have dog go outside for bathroom items.
3 – Dog barks.
4 – Exit Program.
4. Create a story line to go with the program. (2 pts.)
5. Be sure to put in comments. (.5 pt.)
6. How much effort went into the project. (.5 pt.)
Download