Question: 1. Given the following C++ class class vehicle { static enum e_terrain(water, land, air); int topSpeed(){return 0}; e_terrain getTerrain() {return land}; } Define derived classes

1. Given the following C++ class class vehicle { static enum e_terrain(water, land, air); int topSpeed(){return 0}; e_terrain getTerrain() {return land}; } Define derived classes for an airplane, a boat and a car. You can make up values for speed. Note: you may have to make changes to the base class.

2. Write a simple C++ class that represents a bank account. It should have methods to withdraw and deposit money and to get the balance. (An exception should be thrown if any of these tasks cannot be completed). The program that calls your account class is multi-threaded, so you must ensure that the data in your class cannot be corrupted. Assume you have two library methods available startCriticalSection() and endCriticalSection().

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock 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

Students Have Also Explored These Related Databases Questions!