Chapter 9: Exercises 3 & 9 Complete Exercises 3 and 9 in Cha…

Chapter 9: Exercises 3 & 9 Complete Exercises 3 and 9 in Chapter 9. Chapter 10: Exercises 3 & 16 Complete Exercises 3 and 16 in Chapter 10. Click here to access the exercise files for Chapters 9 & 10. Save your work in separate Visual Basic files for each exercise and attach the files in Blackboard for grading. For Exercise Question 16 in Chapter 10, upload a MS Word document that discusses your answer to each of the questions in the exercise.

Chapter 9: Exercise 3:

Exercise 3 in Chapter 9 deals with the topic of inheritance in object-oriented programming. In this exercise, you are asked to create a base class called “Vehicle” with two properties: “Manufacturer” and “Year”. You are then asked to create two derived classes, “Car” and “Truck”, that inherit from the base class “Vehicle”.

The first step in this exercise is to create the base class “Vehicle”. This can be done by creating a new class called “Vehicle” and adding the two properties mentioned above. The “Manufacturer” property should be a string, and the “Year” property should be an integer.

Next, you need to create the derived classes “Car” and “Truck”. To do this, create two new classes called “Car” and “Truck” and inherit from the base class “Vehicle”. In these derived classes, you can add any additional properties or methods specific to cars and trucks.

Once you have created the classes, you can test them out by creating instances of each class and setting values for the properties. For example, you can create a new instance of the “Car” class and set the “Manufacturer” property to “Honda” and the “Year” property to 2020.

Chapter 9: Exercise 9:

Exercise 9 in Chapter 9 focuses on the concept of polymorphism in object-oriented programming. In this exercise, you are asked to create a base class called “Shape” with a method called “Area” that returns the area of the shape. You are then asked to create two derived classes, “Circle” and “Rectangle”, that inherit from the base class “Shape” and override the “Area” method.

The first step in this exercise is to create the base class “Shape”. This can be done by creating a new class called “Shape” and adding a method called “Area” that returns a double value. The implementation of this method will depend on the specific shape, so you can leave it empty for now.

Next, you need to create the derived classes “Circle” and “Rectangle”. To do this, create two new classes called “Circle” and “Rectangle” and inherit from the base class “Shape”. In these derived classes, override the “Area” method and provide the specific implementation for calculating the area of a circle and rectangle, respectively.

Once you have created the classes, you can test them out by creating instances of each class and calling the “Area” method. For example, you can create a new instance of the “Circle” class and call the “Area” method to calculate the area of a circle with a certain radius.

In conclusion, Exercise 3 in Chapter 9 deals with inheritance in object-oriented programming, while Exercise 9 focuses on polymorphism. By completing these exercises, you will gain a better understanding of these important concepts in programming.