Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

/ Exception class class OverSpeed { //Constructor to create OverSpeed s; // A method to display message } // Base class class vehicle{ public: setType(string

image text in transcribedimage text in transcribed

/ Exception class

class OverSpeed {

//Constructor to create OverSpeed s;

// A method to display message

}

// Base class

class vehicle{

public:

setType(string type);

private:

string type;

}

//implement setType(string type);

//Derived class1

class car: public vehicle {

public:

setName(string name);

setSpeed(int speed);

private:

string name;

int speed;

}

//implement setName(string name);

//implement setSpeed(int speed); // OverSpeed exception class

//Derived class2

class truck: public vehicle {

public:

setName(string name);

setSpeed(int speed);

private:

string name;

int speed;

}

//implement setName(string name);

//implement setSpeed(int speed); // OverSpeed exception class

Design a program with vehicle class as base class and two classes: car and truck derived from vehicle. The vehicle class has a method to set the type of vehicle. The car and truck classes have two methods, one to that checks the speeds of cars and trucks. The overspeed limit of cars > 70 and that of truck> 50. set name and the other one to set speed. Write an Overspeed exception class // Exception class class OverSpeed //Constructor to create OverSpeed s; // A method to display message // Base class class vehicle public setType(string type) private string type; //implement setType(string type); /Derived class1

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Machine Learning And Knowledge Discovery In Databases European Conference Ecml Pkdd 2015 Porto Portugal September 7 11 2015 Proceedings Part 3 Lnai 9286

Authors: Albert Bifet ,Michael May ,Bianca Zadrozny ,Ricard Gavalda ,Dino Pedreschi ,Francesco Bonchi ,Jaime Cardoso ,Myra Spiliopoulou

1st Edition

3319234609, 978-3319234601

More Books

Students also viewed these Databases questions

Question

Question Can any type of stock or securities be used in an ESOP?

Answered: 1 week ago

Question

Question Can a self-employed person adopt a money purchase plan?

Answered: 1 week ago