Write a Java program according to the instructions.
Write a Java program according to the followings:
- Super class named Animal as the followings:
- Implements the two interface FinalExam and MidExam
- instance variable: String name.
- instance variable: String voice.
- Public constructor receives two string argument to set instance variable
- Public method get_name returns animal name.
- Public method get_voice returns animal voice.
- Subclass named Cat inherits Animal
- Instance variables: String type;
- Public constructor receives three arguments to set instance variables, (name, voice, type) and then call Animal constructor
- Public method getType returns Cat type;
- Subclass class named Dog that inherits Animal
- Instance variables: String type;
- Public constructor receives three arguments to set instance variables, (name, voice, type) and then call Animal constructor
- Public method getType returns Dog type;
- An interface named FinalExam
- This interface contains one integer value which is equal to 10 and named x.
- This interface contains three methods:
- First method name is getName.
- Second method is getZone.
- Third method is getCategory.
- An interface named MidExam
- This interface inherit FinalExam
- This interface contains three methods:
- First method name is getName.
- Second method is getZone.
- Third method is getCategory.
- Main program
- Create object name a with reference Animal and Cat object.
- Create object name b with reference Animal and Dog object.
- Call all methods inside Cat class
- Call all methods inside Dog class
- Use exception handling
in progress
Programming in Java
1 Answer
Anonymous(s) Post
Login to view answer.