Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

QUESTION 3. This is a compulsory question related to OOP. You are required to provide a mix of descriptive and C++ code answers The class

image text in transcribed
image text in transcribed
image text in transcribed
QUESTION 3. This is a compulsory question related to OOP. You are required to provide a mix of descriptive and C++ code answers The class diagram shown in Figure 1 illustrates a snippet of a software solution that is used by a stock management system of an electronics shop. Answer the following questions in the context of the C++ programming language: a) What is encapsulation? In your answer, refer to Figure 1, and make sure to list and explain the different types of access modifiers used. (8 marks) b) What are inheritance and polymorphism? In your answer, refer to Figure 1 . ( 8 marks) c) Consider the following array declaration: Component * components [3]; Write the required code to instantiate the FIRST element of the array as an object of type Capacitor and the TWO other array elements as instances of class LogicGate. (7 marks) d) Write the implementation of the function displayDetails() for the scenario at the start of this question. [HINT: you must write THREE functions in all- one for each class]. (9 marks) e) Write the implementation of the function enterDetails() for the scenario at the start of this question. [HINT: you must write THREE functions in all - one for each class]. (9 marks) f) What is the name of the technique used for the implementation of the functions mentioned in questions 3(d) and 3(e) ? (2 marks) Page 3 of 4 g) Write the required code asking a user to enter the required details for every instance element of array components. Make sure to invoke and use the appropriate function(s). ( 6 marks) h) Write the code required to display all the details of the components stored in the array components. (6 marks)

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

Essentials of Database Management

Authors: Jeffrey A. Hoffer, Heikki Topi, Ramesh Venkataraman

1st edition

133405680, 9780133547702 , 978-0133405682

More Books

Students also viewed these Databases questions

Question

What are the six traits of professionalism? [LO-2]

Answered: 1 week ago