What is a polymorphic data structure, and how does it work?
Q: want my class to be developed in such a way that no other class (even derived class) can create its…
A: You mentioned that you need a class where no other class should be accessed it even the derived…
Q: What is the difference between an interface, class and an instance of the class? b) Is it a good…
A: ONLY FIRST THREE PARTS ARE SOLVED. KINDLY SEND THE REMAINING QUESTIONS ON THE PORTAL AGAIN TO GET…
Q: C++ is a programming language that can be used to Make a program that calculates the volume of…
A: C++ Program: #include <iostream>using namespace std; // Make a constant for piconst float pi =…
Q: Suppose that a class employeeType is derived from the class personType (see Example 10-10 in Chapter…
A:
Q: We know that an Educational Institute consists of teachers and students. You are required to create…
A: UML class diagram of Person, Teacher, and Student classes: The person is a base class Teacher and…
Q: Make the classes as mentioned above. Make appropriate constructors and functions. Choose access type…
A: The given problem is to be solved using the concept of Object-Oriented Programming where multiple…
Q: Object Oriented Programing Consider the following details of all classes in diagram A person can…
A: Given : A person can be an employee or a student. An employee may have rights of admin officer or of…
Q: Can we make stream insertion and stream extraction operators member functions of the class? If yes…
A: “Yes”, the user can create stream insertion and stream extraction operators member functions of the…
Q: Define a struct type to represent a university student with a name, surname, course, year. Define a…
A: Given: Define a struct type to represent a university student with a name, surname, course, year.…
Q: What is polymorphic data structure? Select one: a.It is a data structure which contains as the…
A: The java.util category library contains many assortment categories that profit of polymorphism and…
Q: Using the scenario of Object oriented programming Q1 Write a program that defines a class with a…
A:
Q: a Toyota class which inherits from a Car class, and is composed of an Engine Note: You already know…
A: In object-oriented programming, the concept of IS-A is a totally based on Inheritance, which can be…
Q: With the advent of object-oriented programming, is it ever necessary to use C-type structs rather…
A: The, answer has given below:
Q: Passing arguments to base classes constructors solves the problem of selecting a base class…
A: GIVEN DATA Passing arguments to base classes constructors solves the problem of selecting a base…
Q: Design the class doctorType, inherited from the class personType with an additional data member to…
A: As per our company guidelines, we are not supposed to answer more than 3 subparts of question and…
Q: 1. Based on the below UML diagram, write the implementation code to represent each class? 2. in the…
A: Given:- Code this in c sharp
Q: Question 4 (students need to interpret code and only write justifications) Solid principle (Liskov)…
A: Here, we describe principle which would be violated if the design is left as is and why?An
Q: Suppose that a class employeeType is derived from the class personType. Give examples of…
A: Member data: string dept; string dateOfHire; Member functions: string EmployeeType::setdept(string…
Q: Let us create the shape class hierarchy. Create a Shape class which must be abstract since we are…
A: code is :
Q: ng the constructor, create three objects from class Voters and store it in the stack memory. Two…
A: Given :
Q: Consider five classes i.e. Professor, Researcher, Department, Laboratory, and University having…
A: Implementation of the problem is below: #include<iostream> using namespace std; class…
Q: must include (concrete classes, abstract classes, interface, the relationship ween classes: IS-A,…
A: Program Approach: 1- As mentioned in the assignment, created an abstract class, interface, main…
Q: CPS 2231 - Lab 5 Abstract Classes and Interfaces Write the code for all the necessary classes and/or…
A: Program: Filename: “Main.java” //definition of main class public class Main { //definition of…
Q: The template method design pattern describes a protocol of communication between an abstract (base)…
A: Find the required answer with reason given as below :
Q: In order to model two and three dimensional points in the orthogonal coordinate system, write the…
A: Actually, program is an executable software that runs on a computer.
Q: Implement the class Point3D. Put the class definition in the header p1.h and the implementation in…
A: #include <iostream>using namespace std;class Point3D{ private: double x, y, z;…
Q: are a type of function that is defined in a class. A ________ key-value pair is a set of values…
A: 1. Methods are a type of function that is defined in a class.
Q: C++ is a programming language that can be used to Make a program that calculates the volume of…
A: Ans: Code: #include <iostream> using namespace std;class Cylinder { float r, h; public :…
Q: Consider the following declarations: (1, 2, 5, 7) How many members does class foodType have?…
A: Note: since your question contain multiple sub-part but we can answer only 3 sub-part at time due to…
Q: Suppose we have an program which is a Human Resources system used to hire and track new employees.…
A: first name hire date birth date employee ID number
Q: Question 6 (a) What is the relationship between classes and objects? (b) Why do we use classes to…
A: Answers:: a) Classes are used to group different data types. Classes doesnot take any memory. It is…
Q: What is meant by an Abstract Data Type (ADT)? What are the advantages of ADTs? How does the concept…
A: Abstract Data Type An abstract data type is used for defining a data type by its behavior from the…
Q: step by step. THANKS Write a pure abstract class named Token that has the following virtual…
A: THIS QUESTION IS RELATED TO SUBJECT OBJECT ORIENTED PROGRAMMING IN C++ . SOLVE this question in dev…
Q: PROBLEM B: Suppose that you want to define a class to group the attributes of an employee. There are…
A: using System;class personType { private string firstName; private string lastName;…
Q: Q#1: Write the abstract class of Person having abstract methods of set name, get name, set age and…
A: Note: Since you have not provided the language to write the code so I am using Java language to…
Q: Computer Science Create an inheritance hierarchy of Rodent: Mouse, Gerbil, Hamster, etc. In the base…
A: Note: This is a multiple-question-based problem. As per company guidelines, only the first question…
Q: Is there any difference between abstract and concrete class
A: Given: Is there any difference between abstract and concrete classes?
Q: Model a room class, whose member data is three integers length, width and height. The class contains…
A: The program is implemented in C++ with object oriented approach. I have not used user input to…
Q: Write an abstract data type for rational numbers (a numerator and a denominator). Include a…
A: Since no programming language is mentioned, I am using c++. Code: #include <iostream>using…
Q: Read the following description carefully: In a Course Management System, the class Course has the…
A: The solution to the given problem is below.
Q: angle objects defined by two points, the top-left and bottom-right corners of the rectangle. Include…
A: Question#1: through object oriented programming Define a class for rectangle objects defined by two…
Q: a.Define the class pointType to implement the properties of a point in a two-dimensional plane. Your…
A: As per guidelines, we are only allowed to answer one question. Define the header file specially…
Q: Consider six classes i.e. Person, Department, Laboratory, and University having following…
A: public class University{ //declaring all the members public String universityName; public…
Q: If three objects of a class are defined, how many copies of that class’s data items are stored in…
A:
Q: Computer Science Write the definition of the class template ArrayListType, and the derived class…
A: #pragma once #include <iostream> // Class Guard. #ifndef ARRAYLISTTYPE_H #define…
Q: With appropriate examples, explain the features of static class members.
A: In C++, a class's data members and member methods can be classified as static. A class can have both…
What is a polymorphic data structure, and how does it work?
Choose one:
a.It is a data structure that stores instances of the same classes as data.
All classes that can be used for storing must have the same parent, and virtual methods are not allowed.
b.It is a data structure that stores instances of the same classes as data.
All classes that can be used to store data must have the same parent and must have virtual methods.
c.It is a data structure that stores instances of the same classes as data.
All classes that can be used to store data must have the same parent and can have virtual methods.
d.It is a data structure that stores instances of several classes as data.
All classes that may be used to store data must have the same parent and include virtual methods.
Step by step
Solved in 2 steps
- What is polymorphic data structure? Select one: a.It is a data structure which contains as the data the instances of same classes.All classes usable for storing must have the same parent and can't contain the virtual methods. b.It is a data structure which contains as the data the instances of same classes.All classes usable for storing must have the same parent and must contain the virtual methods. c.It is a data structure which contains as the data the instances of same classes.All classes usable for storing must have the same parent and can contain the virtual methods. d.It is a data structure which contains as the data the instances of different classes.All classes usable for storing must have the same parent and contain the virtual methods.Problem B Now we are going to use the design pattern for collecting objects. We are going to create two classes, a class AmazonOrder that models Amazon orders and a class Item that models items in Amazon orders. An item has a name and a price, and the name is unique. The Item class has a constructor that takes name and price, in that order. The class also has getters and setters for the instance variables. This is the design pattern for managing properties of objects. The setName() method should do nothing if the parameter is the empty string, and the setPrice() method should do nothing if the parameter is not positive. The class also has a toString() method that returns a string representation for the item in the format “Item[Name:iPad,Price:399.99]”. For simplicity, we assume an Amazon order can have at most 5 items, and class AmazonOrder has two instance variables, an array of Item with a length of 5 and an integer numOfItems to keep track of the number of items in the…Suppose that a class employeeType is derived from the class personType. Give examples of members—data and functions— that can be added to the class employeeType. Also write the definition of the class employeeType that you derived from the class personType, and the definitions of the member functions of this class.
- write a class implementation using C++ from the given class diagram TAKE NOTEOF THE FF SPECIFICATIONS: Using the constructor, create three objects from class Voters and store it in the stack memory. Two voters must have an active account and one voter has a deactivated account. Please note that the deactivated voter account must be still part of the “object”. Test all the functions by making calls. this should be the sample result. Please use simple codes only.Explain why it is preferable to have accessors to private types rather than making the types public, keeping in mind the three reasons that are given below.This lab will exercise your understanding of some of the concepts covered in Chapter 13:overloading operators 1. Create a class, name of your choice, to represent a college class in which students might register. a. Create three private member variables:Class Name (to hold values such as CSC210)Number of StudentsClass Hours b. Overload the >> operator to input, from cin, into the class object, the Class Name and Class Hours c. Overload the << operator to output all the private member variables d. Overload the + (plus) operator to add a value to the Number of Students private member variable.This will represent students registering for the class. e. Overload the - (minus) operator to subtract a value from the Number of Studentsprivate member variable. This will represent students dropping the class. f. The default constructor should initialize the private member variables appropriately. 2. Write a client program to: a. Upon program execution, create one class object that…
- Computer Science Create an inheritance hierarchy of Rodent: Mouse, Gerbil, Hamster, etc. In the base class, provide methods that are common to all Rodents, and redefine these in the derived classes to perform different behaviors depending on the specific type of Rodent. Create an array of pointers to Rodent, fill it with different specific types of Rodents, and call your base-class methods to see what happens. Write a small program to show the difference between calling a virtual function inside a normal member function and calling a virtual function inside a constructor. The program should prove that the two calls produce different results.Answer this qustion with refer to the part 1 and part 2 codes only an eample how to write in pic: In this and final part of the course work you are required to change the definition of the Item_in_Stock class to make it an abstract class and change the getItemCat(), getItemName() and getItemDescription() definitions to make them abstract methods. You are then required to design and implement three classes which are derived from Item_in_Stock class to fully demonstrate the concept of inheritance and polymorphism. Implementation of HP_Laptop class in part II should have given you an idea of inheritance and polymorphism. Three sub classes, one class against each category (Computers, Laptops and Accessories), should contain appropriate constructors, instance variables, setter and getters methods and overridden methods for getItemName(), getItemDescription() and get_Item_details() method. You should be creative and come up with your own ideas of sub-classes. Task 3.1. Draw a UML class…1 You have studied encapsulation and inheritance that are two important concepts of Object- Oriented Programmin and write a program of your own choice in it that can explain these concepts, and in the context of that program.And Also write the main method that can test the classes. write your answer below that will explain 1. How encapsulation and inheritance was achieved in this program? 2. What are the benefits you get after implementing encapsulation and inheritance in this program? 3. What are the disadvantages if you will not use encapsulation and inheritance in this program?
- write a class implementation using C++ from the given class diagram TAKE NOTE OF THE FF SPECIFICATIONS: Using the constructor, create three objects from class Voters and store it in the stack memory. Two voters must have an active account and one voter has a deactivated account. Please note that the deactivated voter account must be still part of the “object”. Test all the functions by making calls. this should be the sample resultconstruct a class implementation through C++ from the given class diagram TAKE NOTE OF THE FF SPECIFICATIONS: Using the constructor, create three objects from class Voters and store it in the stack memory. Two voters must have an active account and one voter has a deactivated account. Please note that the deactivated voter account must be still part of the “object”. Test all the functions by making calls. this should be the sample result(Hand Written Submission) Question # 1 a) What is the difference between an interface, class and an instance of the class?b) Is it a good idea to make member variables private? Why or why not?c) What is a constructor? Is it possible to have more than one constructor?d) What is the difference between static data member and an instance data member?e) What is the difference between composition and aggregation? Question # 2 Write a program to model the kinds of people one finds in a university. The categories are students,teachers and teaching assistant (TAs). All these categories are kinds of Person (Person is abstract class. Ateaching assistant (TA) is a student and a teacher as well.A person has a name (string). A student has grade point average GPA (between 0 to 4), the teacher hasthe number of scholarly papers he/she has published and the teacher assistant has the number of courseshe/she assists.All the classes contain constructors with default arguments to fill all data…