a. An array with an odd number of elements is said to be balanced if all elements
Question:
a. An array with an odd number of elements is said to be balanced if all elements (except the middle one) are strictly greater than the value of the middle element. Note that only arrays with an odd number of elements have a middle element.
Write a C++ function that accepts an integer array and returns 1 or “Balanced” if it is a balanced array, otherwise it returns 0 or “Not Balanced”.
b. Create a class car with make, model, year, OwnerName, RegisNo, Insurers as private fields.
Create the following void methods getcarInfo, storeCarData and processcarInfo as public members of the class.
Create another derived class Commercial with car as it base class. The commercial class should have RegFees, Station,Route as it’s private member fields and CommeCar as it public method.
At program execution stage the following methods are called in the main function getcarInfo, storeCarData of the base class and CommeCar.
Using code snippets write a C++ program to solve the problem above. NB: All functions do not need function definitions but provide the function prototypes