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

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                                    

Step by Step Solution

3.43 Rating (153 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

1 a include using namespace std i... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Document Format (2 attachments)

PDF file Icon

608c00a377398_208028.pdf

180 KBs PDF File

Word file Icon

608c00a377398_208028.docx

120 KBs Word File

Students Have Also Explored These Related Programming Questions!