subject
Computers and Technology, 30.10.2019 04:31 Duriiee

Create an abstract class named animal. this class should have a private name variable of type string, and contain these constructors and methods: public animal(string name) public string getname() public void setname(string name) public string getnameandtype() public abstract void speak() protected void speak(consumer consumer) the getnameandtype() method should return the animal's name concatenated with 'the' and the type of the class (example: 'percy the cat'). create subclasses named dog, cat, and turtle that extend the animal class. these classes should have constructors that call the constructor of the parent class. when the subclasses override the abstract speak() method, they should call the protected speak() method of the parent class and pass it a function. this function contains the functionality for the speak() method for that subclass. you should be able to easily modify this class so an animal 'speaks' by printing data to the console or by displaying a gui dialog box. after the user has entered all the animals they want, each animal that they've entered should 'speak'. use the console class from chapter 7 or a variation of it to validate the user's input.

ansver
Answers: 1

Another question on Computers and Technology

question
Computers and Technology, 21.06.2019 18:30
Ayear in the modern gregorian calendar consists of 365 days. in reality, the earth takes longer to rotate around the sun. to account for the difference in time, every 4 years, a leap year takes place. a leap year is when a year has 366 days: an extra day, february 29th. the requirements for a given year to be a leap year are: the year must be divisible by 4if the year is a century year (1700, 1800, the year must be evenly divisible by 400some example leap years are 1600, 1712, and 2016.write a program that takes in a year and determines whether that year is a leap year.ex: if the input is 1712, the output is: 1712 is a leap year.ex: if the input is 1913, the output is: 1913 is not a leap year.
Answers: 2
question
Computers and Technology, 22.06.2019 09:00
Meenu wants to create a high quality drawing in a variety of colours. which device should she use for the same?
Answers: 1
question
Computers and Technology, 23.06.2019 00:00
Donna and her team of five have invented a new gadget for the science exhibition in their college. which intellectual property right will protect their invention?
Answers: 1
question
Computers and Technology, 23.06.2019 04:40
The narrative structure of the popular movies can be broken down into
Answers: 3
You know the right answer?
Create an abstract class named animal. this class should have a private name variable of type string...
Questions
Questions on the website: 13722361