Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

i need the answers for question 2 and 3 ok please Submission detail: A) Submit cpp file for each question with given main function. B)

i need the answers for question 2 and 3 ok please
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
Submission detail: A) Submit cpp file for each question with given main function. B) points distribution: 50% compilation, 50% correctness. Q1: Create a class named Vehlcle. (20pt) 1. Private data member: brand - dynamic member string 2. Default constructor - set brand to "TBD" 3. One argument constructor to set brand 4. Output function - print brand of Vehicle 5. Mutator and accessor function for brand Use following main() to test your function. int main 0 Vehicle a,b("BMW"); a.output0: // Brand:TBD b.output); // Brand:BMW a.setBrand("Tesia"); cout40pt ) 1. Copy the previous program to a new file. 2. Create a class named Car derived from Vehicle. a. Private data member: welght - dynamic member int b. Implement default and two argument constructors c. Redefine output function d. Mutator and accessor function for weight 3. Create a class named Boat derived from Vehicle. a. Private data member: huliLength - dynamic member int b. Implement default and two argument constructors c. Redefine output function d. Mutator and accessor function for hullLength 4. Convert Vehicle to abstract class. 5. Override output function of Car and Boat class. 6. Override destructor for Car, Boat, Boat Use following main() to test your function. Int main( K I/ part 2 Car a,b("Honda", 2000); a.output(): // Brand:TBD Weight: 0 b.output(0; // Brand:Honda Weight: 2000 b. setBrand("Tesla"); b. setWeight (3000); b.output 0 ; // Brand:Tesla Welght: 3000 II part 3 Boat c,d("Baja",100); c.output(0: // Brand:TBD hullLength: 0 d.output(); // Brand:Baja hullLength: 100 d.setBrand("Bertram"); d. sethuliLength (60) : d.output(0: // Brand:Bertram hullLength: 60 If part 4.5,6 Vehicle 'e, 't: e = new Car( "BMW", 20000); e->output(): // Brand:Honda Weight: 2000 t= new Boat("Baja", 150): f output(): // Brand:Baja hullLength: 100 delete e: delete f : ET580, Exam 4, Fall 2022 Output from main: Brand: TBD Weight: 0 Brand: Honda Weight: 2000 Brand: Tes la Weight: 3000 Brand: TBD hullLength: 0 Brand: Baja hullLength: 100 Brand: Bertram hullLength: 60 Brand: BMW Weight: 20000 Brand: Baja hullLength: 150 = Car Destructor. = Vehicle Destructor. Boats Destructor. = Vehicle Destructor. Boats DestructoF. Vehicle Destructor. Boats Destructor. Vehicle Destructor. Car Destructor. Vehicle Destructor. Car Destructor. - Vehicle Destructor. Q3: Continue of previous question (40pt) 1. Copy the previous program to a new file. 2. Create a class called VehicleNode. 3. Create a class called VehicleList. 4. Implement add function to VehicleList - add new vehicle to the end of the VehicleList 5. Implement print function to VehicleList - print every vehicle of the VehicleList 6. Implement add function to VehicleList - Remove the last added vehicle from VehicleList Use following main() to test your function. int main ()\{ VehicleList list; list.add(new Car("Honda", 1000)); list.add(new Car("BMW",2000)); list.add(new Boat("Baja", 100)); list.add(new Car("Tesla",3000)); list.add(new Boat("Bertram", 60)); list.add(new Car("Toyota", 4000)); coutc"..first print endl; list.print0; list.remove(); list.remove()

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

Real Time Database And Information Systems Research Advances

Authors: Azer Bestavros ,Victor Fay-Wolfe

1st Edition

1461377803, 978-1461377801

More Books

Students also viewed these Databases questions

Question

Prepare for a successful job interview.

Answered: 1 week ago

Question

Describe barriers to effective listening.

Answered: 1 week ago

Question

List the guidelines for effective listening.

Answered: 1 week ago