Question: ASAP PLSSS Exercise 3. Polymorphism Define at least one subclass an extension of the superclass Rider (from Ex1.) of your choice (horseRider, bikeRiders, ...). Define

Exercise 3. Polymorphism Define at least one subclass an extension of the superclass Rider (from Ex1.) of your choice (horseRider, bikeRiders, ...). Define a class RiderCompany that contains information about the company: name, number of riders, and an array of references of the Rider class. For the needs of this class, define a constructor that accepts only one argument - the company name, and a no-argument constructor and the following methods should be defined: void addRider() - a method that will add a new Rider to the array of Riders. double averageOfNumberTours() - a method that returns the average of the number of tours of all riders in the company void printRiders() - a method that prints how many riders there are from each type of riders in the company Hint: For the last method you can use static members and static functions in each of the classes (ex. getClass().getNAme(); instanceOf, etc), dynamic_cast
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
