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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started