Create three derived classes cube, sphere, and cylinder that inherit container, so that each derived class contains virtual functions surface_area and volume (), which are used to calculate the surface area and volume of cube, sphere, and cylinder, respectively. Write the main program and use C++ polymorphism to calculate the surface area and volume of a cube with a side length of 6.0, a sphere with a radius of 5.0, and a cylinder with a height of 6.0.
Q: Write the definitions of the member functions of the class calendarType (designed in Programming…
A: Program plan: • Define a class calendarType that contains the properties of a calendar i.e. day,…
Q: The following C++ code consists of an error. What is the cause of the error? class Human{ public:…
A: This is based on the concept of virtual functions in C++
Q: 2.Create a class in c++ called rectangle which has following mebers- Private-int height,int width…
A: In this question we have to execute a C++ program where we need to create a rectangle class and…
Q: mplement the class “cylinder” with member variables radius and height, which are private of type…
A: As per company guidelines we are suppose to answer only 1 question. Kindly re-post other questions…
Q: You have to built a hospital management system using hybrid inheritance(use atleast 2 types of…
A: there are 5 types of inheritance. 1 single level 2 multilevel 3 multiple 4 hierarchical 5…
Q: define a class with two data members , one to store the name of the country and another to store…
A: Given: define a class with two data members, one to store the name of the country and another to…
Q: Write a program IN C++ to model a student class with roll number and name as the sensitive…
A: Lets discuss the solution in the next steps
Q: Write an OOP program in C++, which contains three, classes i.e. Parent Class, Child1 Class & Child2…
A: Inheritance is a feature of object-oriented programming language in which the base class or parent…
Q: Write the definitions of the member functions of the class calendarType (designed in Programming…
A: Member function: A member function of a class is a function that has its definition or its prototype…
Q: Write the definitions of the member functions of the class calendarType (designed in Programming…
A: Given: Write the definitions of the member functions of the class calendarType (designed in…
Q: Write a class Point that represents a point in 3D cartesian coordinate system. Use Constructors or…
A: To calculate distance: (x2-x1)2+(y2-y1)2+(z2-z1)2 For point P1 distance: (x1,y1,z1) = (0,0,0) and…
Q: Write the definitions of the member functions of the class calendarType(designed in Programming…
A: Answer: Code: Save this file as calendar.cpp #include<iostream>using namespace std;int…
Q: Write a program In C++ to define a class “Bank” that has a member “Bank_Balance” . A person opens…
A: #include<bits/stdc++.h>using namespace std; class bank{int acno;char nm[100];public:…
Q: Write a program in C++, that creates a class Rock with a default constructor, a copy-constructor, an…
A: Copy-constructor and assignment operator: filter_none edit play_arrow brightness_4…
Q: Write a class named circle with data member radius and three member functions get radius() to set…
A: Create a class circle and declare a variable called r to store the value of radius and the data…
Q: NEED A PROGRAM CODE IN C++ IN VISUAL SRUDIO WITH OUTPUT Write a program to overload the * operator…
A: Code: using namespace std;class distance{ private: int feet; int inches; public:…
Q: Q8) Write a C++ program by creating an 'Employee' class having the following members Three Private…
A: ALGORITHM:- 1. Declare and create the class. 2. Create the class object and initialise it. 3.…
Q: Write a class in C++ for employee with private empId and empname; constructor and getter methods.…
A: The main objective of the c++ program is to create three classes to define are Employee class,…
Q: Write a C++ code that uses pure virtual functions in the base class 'universitypersonnel'. The…
A: Solution Programming Approach Using Necessary header file Using standard namespace Create an…
Q: Write an OOP program in C++, which contains three, classes i.e. Parent Class, Child1 Class & Child2…
A: create a parent class create a child class1 and child class2 which will extend the functions of the…
Q: Write a Number class that holds a double, and add overloaded operators for +, –, *, /, and…
A: We need to write a program for the mentioned functionalities. The language used is C++.
Q: Write a C++ program to create a class named circle with data member radius and three member…
A: Required: Write a C++ program to create a class named circle with data member radius and…
Q: Write a program IN C++ to model a student class with roll number and name as the sensitive…
A: PROGRAM CODE: // include the required header files#include <iostream>#include…
Q: Write a program in the C++ language to create a class Triangle with three member integer variables…
A: Task :- Write a C++ program to implement the Triangle class . C++ program :- #include…
Q: Write an OOP program in C++, which contains three, classes i.e. Parent Class, Child1 Class & Child2…
A: Inheritance is a code reusability concept in the object-oriented programming language in which one…
Q: Input data of three countries and display the name of country with greater population
A: Program: // C++ version 14#include<iostream>#include<string.h>using namespace std;//…
Q: Write a program that defines a class Area, with data members PI=3.1419 and radius r. and radius is…
A: Given: Write a program that defines a class Area, with data members PI=3.1419 and radius r. and…
Q: Write a class named circle with data member radius and three member functions get_radius() to set…
A: Actually, program is a executable software that runs on a computer.
Q: Write a C++ program to check for the not- eligible donGr by throwing a custom excepti Strictly…
A: //Donor class #include <bits/stdc++.h>using namespace std;class Donor{protected:string…
Q: Consider a class named Calculator with typical four specific functionalities i.e. addition,…
A: Given: Consider a class named Calculator with typical four specific functionalities i.e. addition,…
Q: Write a program having a base class Student with data members rollno, name and Class define a member…
A: The code for the given problem is written below in c++ language: Code: #include <iostream>…
Q: Write another member function (only) in the previously developed class of SpecialTime in question1,…
A: PROGRAM APPROACH Create a function timer timeMachine(int direction, int duration) This function…
Q: Q2\Write a program in OOP C++ to represent the employee class: 1-Giving information about the…
A: First, we will create class interface. Then we will implement each function defined in interface. We…
Q: Q1. Write a C++ program which will perform the following operations: • Define a class with name Car…
A: Q1. C++ Code for given scenario: #include <iostream> using namespace std; class Car{public:…
Q: Create parent class Shapes with protected parameters width and height and function printarea() and a…
A: A pure virtual function is sometimes called an abstract function, and a class with at least one pure…
Q: urs, minutes, and seconds, might require you to store the time zone. Derive the class extClockType…
A: code : #include "clockType.h" class extClockType : public clockType{ public:…
Q: Write the definitions of the member functions of the class calendarType (designed in Programming…
A: Given:
Q: Write a C++ program to check for the not-eligible donor by throwing a custom exception. Strictly…
A: main.cpp Donor.cpp
Q: Which concept of OOP is false for C++? a) Code can be written without using classes b) Code must…
A: Some Object Oriented Programming languages are strictly Object Oriented and some are not
Q: Write a C# application that implements a class 'Employee' with the following members. i. Six private…
A: Create an Employee instance Set the values Print all the values
Q: write a program c++ Define a class rectangle with the following data members: L,W and the following…
A: Area of rectangle can be calculated by Length*Width
Q: Write the following program in C++
A: #include <iostream> using namespace std; class Employee { public: int empid; string name;…
Q: write the code in C++ in essence, you are coding a class named Color with 3 data items…
A: The main objective of the C++ program is to create two files Color.h ,header file Color.cpp…
Q: 10. Write the definitions of the member functions of the class a. calendarType (designed in…
A: Solution:
Q: Write a program IN C# named SalespersonDemo that instantiates objects using classes named…
A: Answer :
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…
Please solve using oop in c++
Trending now
This is a popular solution!
Step by step
Solved in 3 steps with 3 images
- Using Java - Creating an Abstract Class Shape II Create an abstract class "Shape" with the following specifications: an abstract method "area()" of return type double an abstract method "perimeter()" of return type double. Put your code in a Java source file named "Shape.java." I. Create a class "Rectangle" that extends the Shape class with the following specifications: Attributes: width, length Constructor: Implement a parameterized constructor needed initialize the data. toString: Implement a "toString" method that prints out the area and perimeter. Implement methods to compute the area and perimeter. II. Create a class "Circle" that extends the Shape class with the following specifications: Attributes: radius Constructor: Implement a parameterized constructor to initialize the data. toString: Implement a "toString" method that prints out the area and perimeter. Implement methods to compute the area and perimeter. III. Create a class "Triangle" that extends the Shape class…Create the following classes based on the given declaration. Also, each class should have the default constructor. Just place the prototype of the constructors in the class but you dont have to implement them. The default constructor is a public member. A) CSUSM is an object of class University. Class University has the follow private attributes: -UnivName: string -UnivDepts: a vector of Department class -UnivStudents: a vector of student class -UnivAddress: string -UnivAge: int B) Each department has the following private attributes: -deptName: string -deptFaculty: vector of Faculty class -deptYearCreated: int C) Each student has the following private attributes: -studName: string -studYearOfStudy: int -studNumber: long -studCoursesTaken: vector of Course class D) Each faculty has the following private attributes: -FacName: string -FacYearofExperience:int -FacId: long -FacCoursesTeaches: vector of Course Class E) Each course has the following private attributes:…C++ is a programming language that can be used to Make a program that calculates the volume of different containers. Cylinder will be the base class, and its derived classes, also known as child classes or sub-classes, will be constructed. Create a parent class, Cylinder, first. Make a constant for pi, as you'll need it for any containers that aren't square. For the members, use protected. Finally, add a public function to control the volume. V = pi * (r2) * h is the formula.
- A car has an engine, at most 2 ACs, a handle to control the gears and a brake. If the car is manual, it has a clutch, otherwise it does not. Make three constructors of each class; a default and two parameterized. Using constructor initializer list, call the overloaded constructors of the composed and aggregated classes from the container class kindly write code in C++....Write in java an abstract class Student that includes the following hidden attributes: id(int), name(String), major(String) and grade(double), then create setter and getter for each of them. Write two classes that inherited from Student: ItStudent and ArtStudent. The grade for ItStudent is calculated as: grade = mid*0.30 + project*0.30 + final*40 and the grade for ArtStudent is calculated as: grade = mid*0.40 + report*0.10 + final*50. Crate main class that achieve the following:a. Create an array of some Student objects from both ItStudent and ArtStudent classes.b. Sort the Student objects by grade in descending order using functions.c. Save the sorted objects into file.The Java Programming class has two types – remote and in-person. For remote students, the weighted score comprises of midterm, final, assignments and discussion. The weights for each are 30%, 30%, 30% and 10% respectively. For in-person students, the weighted score comprises of midterm, final and assignments. The weights for each are 30%, 30% and 40%. Write a generic class Students.java which has a constructor that takes three parameters – id, name, and type. Type will represent if the student is ‘remote’ or ‘in-person’. A toString() method in this class will display these details for any student. A generic method score() will be part of this class and it will be implemented by inherited classes. Write accessors and mutators for all data points. Write two classes RemoteStudents.java and InPersonStudents.java that inherits from Student class. Show the use of constructor from parent class (mind you, RemoteStudents have one additional parameter – discussion). Implement the abstract method…
- Answer the given question with a proper explanation and step-by-step solution. The base class Pet has protected fields petName, and petAge. The derived class Cat extends the Pet class and includes a private field for catBreed. Complete main() to: create a generic pet and print information using printInfo(). create a Cat pet, use printInfo() to print information, and add a statement to print the cat's breed using the getBreed() method.Let’s build a Player Portfolio System that has interface and abstract classes. Inheritance using Interface: Create a new Player Interface. This will have common attributes defined for a player and have at least two methods that will need to be implemented in the derived classes. Here is an example: public interface Player {String getName();int getStats();String getSport();} Create NFL Player and NBA Player concrete classes that will implement Player interface. Develop appropriate unit tests.Create an abstract class Product with following Properties Price (Decimal), Code (string), Description (string) Create an interface ISellable with the following Method sell that takes the count of the products to sell and returns the cost public decimal sell(int count); Create a concrete class Book that Inherits from class Product and implements interface ISellable Has additional Property Author (string) Add a constructor with parameters, and ToString method to display all of data of class Book Similarly, create anot concrete class Software that Inherits from class Product and implements interface ISellable Has additional Property Version (string) Add a constructor with parameters, and ToString method to display all of data of the class Software Finally, write a client code (main program) that will utilize the class and interface hierarchy you created. Create two Book objects for the following books C# 8.0 in a Nutshell, with price $50.99 and with ISBN…
- In java Create an abstract super class called Employee with the following attributes: name : String and the following methods getter and setter for the one attribute three constructors an abstract method called getSalary() equals() toString() Create a sub class of Employee called Faculty with the following attribute yearlyPay : double department: String and the following methods getter and setter for the attributes three constructors getSalary() that returns the yearlyPay divided by 52 equals() toString() Create a sub class of Employee called Staff with the following attributes: hoursWorked : double payrate : double and the following methods getters and setters for the two attributes three constructors getSalary() that returns the weekly pay (multiply hoursWorked by payrate, overtime included and 1.5 times payrate for hours > 40) equals() toString() Create a sub class of Employee called Sales with the following attributes: salesAmount : double //sales per week…Write a Java class Person for dealing with persons. Your class must have the following features: Person id: long name: String gender: String + Person() + Person (id: long, name: String, gender: String) + Create setter and getter for all data fields. + Override toString() method: you have to return required data Fields values. Constructor: public Person(): A default constructor, should initialize the data fields to their default values. public Person (SSN: long, name: String, gender: String): A constructor with parameters, that creates the person object by setting specified parameters. Instance methods: public void setName(name: String): Used to set the full name of the person. public void setGender(gender: String): Used to set the gender of the person. public long getId(): This method returns the id of the person. public String getGender(): This method returns the gender of the person. public String getName(): This method returns the full name of the person. public String…1). Write a java abstract class called Solid and you will derive two classes – Cylinder and Sphere – from Solid. The class Solid Member variables type whose data type is String. For example, the type could be sphere, cube, parallelepiped. 2). The methods should include: A default or null constructor A constructor that initializes the value of type Getters and Setters An abstract method to find volume whose signature is public abstract double findVolume(); An abstract method to find surface area whose signature is public abstract double findSurfaceArea() a toString method that returns a string like the following Solid Type: Sphere an equals method that returns true if two Solid objects have the same type and false otherwise. 3). The class Cylinder - Cylinder will extend Solid Member variables: Cylinder inherits type from Solid radius of type double height of type double Methods: a default or null constructor a constructor that initializes type, radius, and height. type will always…