Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

please work in C++ QUESTION 3. This is a compulsory question related to OOP. You are required to provide a mix of descriptive answer and

please work in C++

image text in transcribedimage text in transcribed

QUESTION 3. This is a compulsory question related to OOP. You are required to provide a mix of descriptive answer and C++ code. A shipping company has a large fleet of Takers and Container ships. You are required to implement a simple program using object-oriented programming techniques that is going to be used to hold the basic information about the vessels of this shipping company. Note that each ship has the following basic information: name, IMO number, port of registration, length, beam, draft, cruising speed, and vessel classification. These two categories of ships use different capacity measurements - container ships use TEU (Twenty-foot equivalent units) while tankers use DWT (Deadweight Tonnage). Answer the following questions: a) What is the meaning of inheritance and polymorphism in the context of OOP? Enhance your answer by making a reference to the above shipping company scenario. Suggest how inheritance and polymorphism techniques can be used to represent the above types of ships. In you answer clearly indicate any super classes and sub classes. (13 marks) b) Implement using C++ the classes mentioned in question (a) above. Your implementation should include the following: i. Use of encapsulation but there is no need to implement any getters and setters. (5 marks) ii. Implementation of constructors that accept as parameters all the attributes of the respective class. (8 marks) iii. Implementation of (override) functions (called displayDetails) that can be used to display the details of the ships. (12 marks) c) Declare an array that can hold three instances of Tankers and/or Container vessels. (5 marks) d) Instantiate three objects and store them in the array that you have declared in question (c) above. The objects should represent a tanker and two container ships with the following information: (1

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

Practical Issues In Database Management A Refernce For The Thinking Practitioner

Authors: Fabian Pascal

1st Edition

0201485559, 978-0201485554

More Books

Students also viewed these Databases questions

Question

Describe the origins of gender-based prejudice during toddlerhood.

Answered: 1 week ago

Question

What is a standardized normal curve?

Answered: 1 week ago

Question

7. Define cultural space.

Answered: 1 week ago

Question

8. Describe how cultural spaces are formed.

Answered: 1 week ago