Circle and polygon from the class Shape that contain o A parameterized constructor to initialize data members that they inherit from the class Shape In the main(), create instances of Shape Circle and Polygon classes. Invoke displayarea() with shape object while passing references of Circle
Q: Define a class named Document that contains a member variable of type stringnamed text that stores…
A: Given: Define a class named Document that contains a member variable of type stringnamed text that…
Q: 6.3. Write a class LocalPhone that contains an attribute phone to store a local telephone number.…
A: Given: Write a class LocalPhone that contains an attribute phone to store a local telephone number.…
Q: 1. Implement a Student class. a. Create a class Student with the following private data members: 1.…
A: Note : we have calculated GPA as average of two grade provided .
Q: Write a definition of a class named Point that might be used to store and manipulate the location of…
A: GIVEN: Write a definition of a class named Point that might be used to store and manipulate the…
Q: et us create the shape class hierarchy. Create a Shape class which must be abstract since we are not…
A: Source code link:- copy and paste it : https://onlinegdb.com/BkK9W7xw_
Q: Define a class Book in C++, which has the following private data members: a) BookName b) BookAuthor…
A: The class contains private data members and public member functions. The functions are declared…
Q: Create a class Student that contains information about a student’s name, semester, roll no, and date…
A: Program Explanation: 1) Implement the header file. 2) Declare the integer 3) Implement the main type…
Q: Write a class Person. It should have the following three attributes: a. Name b. Age c. Gender…
A: #include <iostream> #include <string> using namespace std; // Person class class Person…
Q: Create a class Rectangle that has two data members, width and height, and two overloaded class…
A: If a class has many functions with the same names but different parameters, it is said to be…
Q: Write a program to create a base class: "Question3", with protected data member: x (int) and with…
A: Approach: - Include the header file and then use the namespace std.Define the class…
Q: using C++ 0OP Q1: Consider a class network of fig(1). The class Result derives information from two…
A: Your C++ program is given below as you required with an output.
Q: Question no 2: Consider the following details of all classes Person Employee Student Administration…
A: Solution: Given: To Find: To write the code for the following classes.
Q: Write a C++ program that will create three (3) classes named respectively: GeometricPoint.h…
A:
Q: 1. Implement a Student class. a. Create a class Student with the following private data members: 1.…
A: Class is a user-defined data type that contains the data members to store the values. The member…
Q: Object Oriented Programming BS (2"d) Midterm Exam Date: 03-05-2021 Submit Till 03-05-2021 (4:00 PM)…
A: Note: The solutions of the first three questions are shown below. Please repost the remaining…
Q: 2. Create a class home with following data members, area (int), and cost as protected data member.…
A: Acquiring the base class properties and methods/functions to the child classes is called…
Q: Create a class home with following data members, area (int), and cost as protected data member.…
A: Program approach:- Using the necessary header file. Using the standard namespace I/O. Define the…
Q: 1. Create an Employee class with the following attributes and functions: Attributes: • idno • name •…
A: Program Explanation: Define a class for loan Declare all the required attributes for the loan class…
Q: Q1: Consider a class network of the following figure. The class Result derives information from two…
A: Note :- You have not mentioned the language of the program so, i'm answering your question in C++…
Q: • Define a base class shapeClass , the class o Has two data members width and height, which are…
A: Programing Approach: // including header file and using namespace // defining shape class // width…
Q: Using the law of the big three in c++
A: Program code to implement the class Food and its dynamic data member and another class named cake…
Q: Write a program to create a base class: “Question3”, with protected data member: x (int) and with…
A: Note: This code should be rewritten instead of copying to the compiler otherwise it will throw a…
Q: Let us create the shape class hierarchy. Create a Shape class which must be abstract since we are…
A: code is :
Q: Write a program to create a base class: “Question3”, with protected data member: x (int) and with…
A: Pure virtual function in base class has only the declaration of the function without the body of the…
Q: Write a base class Computer that contains data members of wordsize(in bits), memorysize (in…
A: #include <iostream> using namespace std; //Create a base class class Computer { public:…
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: 8.A car dealership has hired your software development firm to create a new car inventory program.…
A: A car dealership will have different cars and the business process will include the orders of cars…
Q: Write a base class Computer that contains data members of wordsize(in bits), memorysize (in…
A: Note: Since only class definition is needed, and output screenshot is not provided. both code and…
Q: Q 1. a) A class Student has RollNo, name, class Internal_exam has sublmark, sub2marks, class…
A: Include the header files Create a class Student with data member rollno and name Define a getdata()…
Q: 1. Implement a Student class. a. Create a class Student with the following private data members: 1.…
A: Since multiple questions are given here we are able to provide solution for only the first one. C++…
Q: Define a class Distance with two private integer members km and m to represent kilometers and meters…
A: A class is a blueprint from which individual objects are created. A class can contain any of the…
Q: eate a program in C++ language to achieve the following tasks: a. Create a ThreeDimensionalShape…
A: #include <iostream> using namespace std;class ThreeDimentionalShape{public: int height =…
Q: 4.a. Consider the class network of the following figure. Person Came code Account Admin salary No of…
A: The program is written in C++ #include <iostream>using namespace std;#include <string>…
Q: • Define a base class shapeClass , the class o Has two data members width and height , which are…
A: Since the Programming language is not mentioned in the question, we will answer this question in…
Q: 2. Create a class called Car which has the following members- Private color, maxSpeed, minSpeed…
A: In this question we need to create two classes. Car class is parent of Bus class. Bus class inherits…
Q: Q1: Consider a class network of the following figure. The class Result derives information from two…
A: Note :- You have not the language of the program so. i'm answering your question in C++ language.…
Q: Write a program to create a base class: “Question3”, with protected data member: x (int) and with…
A: Derived class that inherits the properties of the base class properties is called inheritance.…
Q: Define a class template named Alice that takes a single type parameter. Make Alice a friend of all…
A: #include <iostream>using namespace std;class Friendly;template <class T>class…
Q: Write a C++ program that will create three (3) classes named respectively: GeometricPoint.h…
A:
Q: Given main(), complete the Calculator class (in files Calculator.h and Calculator.cpp) that emulates…
A: Program Explanation: Include the required header files Define a class for calculator Define the…
Q: Learning from the "Pointers-Inheritance and Dynamic Polymorphism" and "Pointers and Dynamic Memory -…
A: Actually, java is a object oriented programming language. It is a platform independent.
Q: Write a program to create a base class: “Question3”, with protected data member: x (int) and with…
A: C++ code: #include <iostream>using namespace std; // creating a base class "Question3"class…
Q: 1. Implement all these classes while illustrating the concept of aggregation and composition in…
A: Create class university with mentioned criteria. Create class department with mentioned criteria.…
Q: Create a class HugeInteger that uses a 40-element array of digits to store integers as large as 40…
A: Filename: main.cpp #include<iostream> #include "HugeInteger.h" using namespace std;…
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: Ql: Consider a class network of fig(1). The class Result derives information from two branch, find:…
A: Note :- You have not mention the language of the program so, i'm answering your question in C++…
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: 1. Implement a Student class. a. Create a class Student with the following private data members: 1.…
A: Note: We are authorized to answer only one question at a time. Since you have asked more than one…
Q: Q 1. Consider the following class definition class father { protected : int age; public; father (int…
A: Given:
Q: Q. No.1: a) Implement the following class hierarchy. TEACHER AUTHOR SCHOLAR 1) Add appropriate data…
A: MULTIPLE INHERITANCE: inheriting a class from more then one class is called as multiple inheritance.…
• Consider a class Shapethat contains
o A data member named as ShapeName of string type
o A data member named as areaof type int
o A member function displayarea()
• Derive two classes named Circle and polygon from the class Shape that contain
o A parameterized constructor to initialize data members that they inherit from the class
Shape
In the main(), create instances of Shape Circle and Polygon classes. Invoke displayarea() with
shape object while passing references of Circle and Polygon instances.
Step by step
Solved in 2 steps
- Create a class named Line: (a) Define private data members p1 and p2 as pointer to Point objects (the one we had in lectures), slope and length as double variables. (b) Define setter and getter functions. (c) Define a null-constructor that initializes numeric variables with zero and allocate dynamic memory for points and initialize them to [0,0] as well. (d) Overload a constructor that allocates memory for points, initilize them with given arguments, and calculate the slope and length. (e) Implement destructor, copy constructor and copy assignment operator. (f) Create a function called ”parallel” that takes too Line objects, returns true when given lines are parallel and returns false otherwise. (g) Overload the less than (<) and greater than (>) and equality (==) operators (compare the length). (h) Write a functions that reads lines in the format provided in the lines.txt from the file (without any change) and stores them in a vector named Lines. (i) Sort the objects of Lines…Model a room class, whose member data is three integers length, width and height. The classcontains two constructors to initialize the room class objects, first is no argumentconstructor, while the second in three arguments constructor. Class also contains threemember functions i.e., getdatat) to get the data from user and store in the memory of callingobject and showdata) to show the room data of calling object, int volume(int I, int w, int h)function should receive the length, width and height values from the objects one by one andreturn the volumes of the three objects respectively.Write a main program to declare the three object rl, 12, and 13 of room class. Two objectwill store the values through three argument constructor and third object will get the datafrom user by calling getdata function. Then all three objects should call the volumefunctions to calculate their volumes and store them in three variables of type integer. Finallythe system compare the three volumes values…Let us create the shape class hierarchy. Create a Shape class which must be abstract since we are not going to create any instance of this class. Provide data members for storing area and volume in this class. Provide a virtual function for displaying the data members of this class, a virtual function for computing volume of a shape, and a virtual function for computing area of a shape.Derive two abstract classes TwoDimensional and ThreeDimensional from this class. Provide a virtual member function to display whether an object is 2-dimensional or 3-dimensional. Also include virtual area and volume functions so these calculations can be performed for objects of each concrete class in hierarchy. Implement the hierarchy and write a main program to test the polymorphic behavior of this class.define class by considering the followings: Enlist data members and methods with access specifies. Consider the polymorphism technique for the use of function overriding. Enlist constant and static…
- write a phyton code: 1- define a class CommissionEmployee that:a. has a firstName, lastName, socialSecurityNumber, grossSales and commissionRateinstance variablesb. does initialize its properties to the values given at the time of instantiation withdefault valuesc. does provide a string representation when we call print on it2- define a class BaseCommissionEmployee, that is a CommissionEmployee anda. has a " baseSalary " property that tells us the base salary per weekb. does initialize its properties, inherited from CommissionEmployee class and definedin BaseCommissionEmployee, to the values given at the time of instantiation.c. has a method earnings that calculates and returns commission employee's pay(baseSalary + ( commissionRate * grossSales ))d. does provide a string representation when we call print on it3- define a class CommissionTester thata. has a method "main" to test the CommissionEmployee and BaseCommissionEmployeeclassesb. the main method must instantiate the class into…a.Define the class pointType to implement the properties of a point in a two-dimensional plane. Your class must contain functions to individually set and retrieve the x and y coordinates, find the distance between this point and another point, and constructors to initialize pointType objects. If p1 and p2 are pointType objects, then p1.distance(p2) returns the distance between p1 and p2.b. Write the definitions of the member functions of the class pointType defined in part a.c. If we know two points on a line, we can describe various properties of a line, such as whether the line is vertical, horizontal, or slanted, and if the line is nonvertical, then find its slope. Define the class lineType with two private data members of type pointType to store the coordinates of two points on a line in the two-dimensional plane. Among others, your class must contain functions to determine if the line is vertical, horizontal, or slanted, find the slope of the line, and output the equation of the…Consider a base class named Employee and its derived classes HourlyEmployee and PermanentEmployee while taking into account the following criteria.• Employee class has two data fields i.e. a name (of type string) and specific empID (of type integer)• Both classes (HourlyEmployee and PermanentEmployee) have an attribute named hourlyIncome• Both classes (HourlyEmployee and PermanentEmployee) have three-argumentconstructor to initialize the hourlyIncome as well as data fields of the base class• Class HourlyEmployee has a function named calculate_the_hourly_income to calculate the income of an employee for the actual number of hours he or she worked. One hour income is Rs. 150 • Similarly, PermanentEmployee class has function named calculate_the_income to calculate the income of an employee that gets paid the salary for exact 240 hours, no matter how many actual hours he or she worked. Again, one hour salary is Rs. 150.Implement all class definitions with their respective constructors to…
- 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…Create a class called Line with the followings:1. Private members: p1 and p2 as pointer to Point objects (code provided below), slope and length as double variables2. Define setter and getter functions.3. Define a default constructor that allocate dynamic memory for points andset everything to 0.4. Overload a constructor that allocates memory for points, initilize themwith given arguments, and calculate the slope and length.5. Overload a destructor, a copy constructor and a copy assignment operator.6. Create a function called ”parallel” that return true when given lines areparallel and returns false otherwise7. Overload the less than (<) and greater than (>) and equality (==) oper-ators (compare the length)8. Write a functions that reads lines in the format provided in the lines.txtfrom the file and stores them in a vector named Lines.9. Sort the objects of Lines vector in descending order.10. Extend the functionality of cin and cout for this class11. Write a separate file to…Learning from the "Pointers-Inheritance and Dynamic Polymorphism" and "Pointers and Dynamic Memory - new - delete" example code in the files above, create three classes that exhibit dynamic polymorphism using the functions area(), circumference(), and draw(): Polygon Class Superclass Variables: double width double height Polymorphic Member Functions: area() circumference() draw() Rectangle Class Subclass of Polygon Variables: int size = 5 double* history_width_ptr double* history_height_ptr Constructor/Destructor Constructor creates space in free memory for two arrays that can store previous values of width and height: history_width_ptr = new double[size] // allocate new memory to previous width values history_height_ptr = new double[size] // allocate new memory to previous height values Destructor delete[] history_width_ptr delete[] history_height_ptr Regular Member Functions: set_values() Sets values for height and width based upon user input Then stores…
- Create a base class named Point consisting of x and y data members representing point coordinates. From this class, derive a class named Circle with another data member named radius. For this derived class, the x and y data members represent a circle’s center coordinates. The member functions of the Point class should consist of a constructor, an area() function that returns 0, and a distance() function that returns the distance between two points,(x1,y1) and (x2,y2), where Additionally, the derived class should have a constructor and an override function named area() (PI*pow(radius,2)) that returns a circle’s area. Task: 1-Include the classes constructed in a working C++ program. 2-Have your program call all the member functions in each class. 3- In addition, call the base class’s distance() function with two circle objects and explain the results this function returns.Assume the definition of class foodType as given in Exercise 6. Answer the following questions? (1, 2, 3, 5, 6) Write the definition of the member function set so that private members are set according to the parameters. The values of the int and double instance variables must be nonnegative. Write the definition of the member function print that prints the values of the data members. Write the definitions of the member functions getName, getcalories, getFat, getSugar, getCarbohydrate, getPotassium to return the values of the instance variable. Write the definition of the default constructor of the class foodType so that the private member variables are initialized to 0, 0. 0, 0, 0. 0, 0. 0, respectively. Write the definition of the constructor with parameters of the class foodType so that the private member variables are initialized according to the parameters. The values of the int and double instance variables must be nonnegative. Write a C + + statement that prints the value of the object fruit 2. Write a C++ statement that declares an object my Fruit of type foodType, and initializes the member variables of myFruit to Apple, 52, 0. 2, 10,13.8, and 148.0, respectively.In Chapter 10, the class clockType was designed to implement the time of day in a program. Certain applications, in addition to hours, minutes, and seconds, might require you to store the time zone. Derive the class extclockType from the class clockType by adding a member variable to store the time zone. Add the necessary member functions and constructors to make the class functional. Also, write the definitions of the member functions and the constructors. Finally, write a test program to test your class.