logo

Inheritance Exercise

   

Added on  2019-09-16

2 Pages447 Words340 Views
 | 
 | 
 | 
LAB: InheritancePart A – playing with code.1.Save the CatExampleWithInheritance application available on the course page for this week in a trusted location and study the code. Comment the c#code (all the main lines, especially the ones linked to inheritance)2.Save the InterfaceExample application available on the course page for this week in a trusted location and study the code Comment the c# code (all the main lines, especially the ones linked to inheritance)Part B - Change the CatExampleWithInheritance application that you downloadedEXERCISE 1: change the necessary code in the following way:1.In the Cat class add a method called “HasFlees()” which should return a Boolean. This method should be seen only by the base Cat class and its children. The method should return true value. Change the Talk() method so it would say if the cat has flees.2.In the BreedCat class override the method “HasFlees()” and make it return falseEXERCISE 21.You should have noticed that showing cat images is not implemented in a consistent way. Change the code in such way that every cat has a specific image in the following way:In the class Cat have a field “imageString” of type string.Change the code in such way that Fluffy and Jassie are instantiated with the correct images (use a particular cat image for each) .Change the code in such way that all new cats (moggies) will have a particular image of your choiceChange the code in such way that for the breed cats the user can choose a breed from a drop down list and, according to the selected breed, a specified image is displayedHint: you can store the breeds and the images’ names in arrays, generic lists or a table in the database
Inheritance Exercise_1

End of preview

Want to access all the pages? Upload your documents or become a member.

Related Documents
CE03: Character and Item Classes
|3
|1002
|81

Programming Paradigms and Scopes
|2
|647
|530

Working with Sessions and Collections
|4
|860
|356

Returning Home Fragment after Saving Data
|9
|4524
|331

Parallel Distributed Branch and bound solution in rmi PDF
|18
|829
|98

Implementing Breakout/Arkanoid in JavaFX
|2
|885
|200