What will the output be for the following code? tinclude using namespace std; class Person public: virtual void Play() = 0; void Study () { cout « "Person::Study" << endl; } class Student: public Person public: void Play () { cout « "Student:: Play" « endl; } virtual void Study () ( cout « "Student::Study" <« endl; } class cs_Student : public Student public: void Play () I cout « "cs_student:: Play!"
Q: Write a simple class named Circle, with three private variables: doubles named x, y and radius. The…
A: #include <bits/stdc++.h>using namespace std;class Circle{ private: double x; double…
Q: Question 1 Suppose we have the following definitions: class Frabjous { private: char fab[20];…
A: ANSWER:-
Q: Part (1) Define a class with the following specification: The class name is Exam with three private…
A: Program: Filename: “Main.java” public class Main { public static void main(String[] args) {…
Q: Part (1) Define a dass with the following specifications: a. The class name is HeightWeightRatio…
A: Given data need to create one HeightWeightRation class. It has private data member gender, height,…
Q: The base class Pet has attributes name and age. The derived class Dog inherits attributes from the…
A: class Pet: def __init__(self,name,age): #constructor of Pet class self.name=name…
Q: amountofcontainers int amountofholds: int Gload (containes: int) load (type: String ) 1) Create a…
A: public class Ship { public int length; public double grosstonnage; public String flag; public…
Q: Analysis the following class definition and answer the following question. class Student{…
A: The correct option is option e. age
Q: Write a test program which initializes each class object and shows execution order of constructor…
A: The first question will be answered only. Approach: When we create a derived class object, the base…
Q: The base class Pet has attributes name and age. The derived class Dog inherits attributes from the…
A: the code is given below :
Q: If class A inherits class B and class C as "class A: private class B, public class C {// class…
A: This question comes from Object Oriented Programming which is a paper of Computer Engineering. Let's…
Q: Consider the following code: public class DemoClass{ private double PI = 3.1416; void…
A: class DemoClass{ final private double PI = 3.1416; // Use final such that PI can not be modified…
Q: The following class declaration has errors. Locate as many as you can. class Point {private: int…
A:
Q: Using classes and arrays, the team will develop a set of functions for an online shopping system.…
A: Actually, program is an executable software that runs on a computer.
Q: Class Car • extends MotorVehicle • concrete class one field trunkCapacity • Overloaded constructor:…
A: JAVA Code: // For MotorVehicle class public abstract class MotorVehicle extends Object{ private…
Q: Suppose that a class is defined to represent a deck of cards or a player's hand in a card game. This…
A: ANSWER:-
Q: What is the output of executing the following code? public class Faculty extends Employee { public…
A: Hey there, I am writing the required solution based on the above given question. Please do find the…
Q: The class Flight represents an airline flight has the following instance data: • airline name –…
A:
Q: Given the following class declaration (with prototypes): class Carpet { private: double…
A: class Rectangle{ double l,b; Rectangle(double x,double y){ l=x; b=y; } }…
Q: Part (1) Define a dass with the following The class name is HeightWeightRatio with three private…
A: HeightWeightRatio Class (Part1): class HeightWeightRatio { // private data members…
Q: Given the following declarations class Dog publiei virtual void bark () (cout << "bark" << endl: )…
A: Since you have asked multiple questions, according to the company's policy we will solve the first…
Q: Consider the following class definition: (8) class base { public: void setXYZ(int a, int b, int c);…
A: a. Which member functions of the class base are protected? Answer: void setZ(int c) { z = c; }void…
Q: If class A inherits class B and class C as "class A: private class B, public class C {// class…
A: Inheritance is defined as the method of basing a class with another class as part of deriving new…
Q: Write a class Distance which has two private data members (int feet,float inches). The class has…
A: public class Distance{ //two private data members private int feet; private float inches;…
Q: Assume that class Item has following two private data fields: private String name; private…
A: Given: Assume that class Item has following two private data fields: private String name;…
Q: Consider the following declarations: class xClass { public: void func(); void print() const ; xClass…
A: a. The constructor name is the same as the class name. In the given code, we have 2 constructors,…
Q: Part (1) Define a dass with the following specifications: a. The class name is HeightWeightRatio…
A: The answer is follows.
Q: Complete the thick.h, thick.cpp, thin.h, and thin.cpp classes in the attached pizza solution. Modify…
A: C++ is a compiled language that follows the concept of oops to make projects. It is used to build…
Q: A constructor: A always accepts two arguments B) has the same name as the class C) has return type…
A: A constructor is a special method of a class. The constructor will have the same name as the class…
Q: What is the name of parameter used in setPrice?
A: We are given a code and in a function declaration we are asked which one is the function parameter?
Q: a class Rational for performing arithmetic with fractions. Write a driver program to test the class.…
A: NOTE: - Since the programming language is not mentioned, it is implemented in c++. PROGRAM…
Q: Part (1) Define a class with the following specifications: The class name is HeightWeightRatio with…
A: import java.util.Scanner; class HeightWeightRatio{ private String gender; private double…
Q: unction to get value of all data members individually • A member function setSpeed( ) // takes…
A: Summary:In this question, we need to create a class which contains the given data members and…
Q: A1. Find the output of the following code in order. public class Faculty extends Employee ( public…
A: Given: public class Faculty extends Employee{ public static void main(String[] args) {…
Q: Create a class Student with following instance private variables and member functions: Variable: id…
A: Code: import java.util.Scanner; class Student { private int id; private String name, Major;…
Q: What mistake prevents the following class declaration from functioning properly as an abstract…
A: An Abstract class is a restricted class that cannot be used to create objects. It is a partially…
Q: 1.2 The class Notebook has the following instance data: • Brand name – example: Acer, Dell, Lenovo…
A: class Notebook { //Variables of Notebook Class String brandname,itemcode; double…
Q: Write a Program in java to define a Student class, with member variables String name; int cms…
A: public class Student{ //creating specified data members private String name; private String…
Q: Analysis the following class definition and answer the following question. class Store{…
A: Here the modifier of the amount is of double data type. And it is protected.
Q: what problem in this java code cant find the main, can you check code package EmployeePersonal;…
A: package EmployeePersonal; //create a Driver class public class Driver { //Define main() method…
Q: Assuming the following is the beginning of the constructor definition for class BasePlus-…
A: BasePlusCommissionEmployee::BasePlusCommissionEmployee(String first, string last, string ssn, double…
Q: A1. Find the output of the following code in order. public class Faculty extends Employee ( E public…
A: One can use any one of the java compilers such as eclipse, Netbeans, or JDK in order to execute the…
Q: 1 using static System.Console; 2 class ShapesDemo 3 { static void Main() { abstract class…
A: Netezza is the appliance of IBM, whereas it is not used in big data to provide high storage; it is…
Q: Using classes and arrays, the team will develop a set of functions for an online shopping system.…
A: Actually, program is an executable software that runs on a computer.
Q: r class contains non static members, then the class name must be modified by the keyword: Final…
A: the answer is an static
Q: Question 3 What problems might the following nested class declaration have? class Ribs { private:…
A: The question is to find the problem using the nested class.
Q: Create a class Car, which contains • Three data members i.e. carName (of string type), ignition (of…
A: Sample Response: //C++ programming language#include <iostream>using namespace std; //base…
Q: creates a class called leverage with one private data member, crowbar, of type int and one public…
A: EXPLANATION Create class leverage, which will have only one data field crowbar. Use a constructor…
Q: Assume that class Item has following two private data fields: private String name; private int code;…
A: Here in super class Item we have only one Constructor that takes two argument String n and int c.…
Please answer #7, the output for #6 should be:
CS_Students::Play!
CS_Students::Study!
Step by step
Solved in 3 steps with 1 images
- Q1) Write the Code the following scenario. Write an abstract function named receivePay in interface with return type double and no parameters. Write another incomplete function, name Show with return type void and an argument of type int in that interface. Build a class with name Bill that implements the above interface. Bill class with name BillId , itemsquantity and itemsprice with proper datatypes with private access . Define two constructors,one default and other is parameterized to initialize the class members . Now receivePay has to beimplemented in such a way that its displays product of itemsquantity and itemsprice and Display function will display the BillId.Can we do same task with abstract class instead of interface? NOTE:SUBJECT:CSHARP (VISUAL PROGRAMMING)Q2: Consider the following statements: public class YClass { private int a; private int b; public void one() { } public void two(int x, int y); { } public YClass() { } } class XClass extends YClass { private int z; public void one() { } public XClass() { } } YClass yObject; XClass xObject; Write the definition of the default constructor of YClass so that the instance variables of YClass are initialized to 0. Write the definition of the default constructor of XClass so that the instance variables of XClass are initialized to 0. Write the definition of the method two of YClass so that the instance variable a is initialized to the value of the first parameter of two and the instance variable b is initialized to the value of the second parameter of two. please I want solution :(Analysis the following class definition and answer the following question. class Student{ private int id, age; protected float mark; int getAge (int a){ return a ; } protected void setMark (float m){ mark = m; } float result(){ return mark / 2; } } What is the access specifier of the result in the above code? a. No access specifier b. private c. float d. public e. void
- Question: 3Implement the design of the Doctor and Engineer class derived from Person class so that the following code generates the output below:class Person: def __init__(self, name, contact): self.name = name self.contact = contact def __str__(self): s = f"Name: {self.name}\nContact: {self.contact}" return s#Write your code hered = Doctor("Dr Strange", "4585632", "Neurosurgery", "DMC")d.add_patients("Dhaka Abdur Rahim", "Dhaka John Cena", "Narayanganj John Wick", "Comilla CM Punk")print("1.=========================================================")print(d)print("2.=========================================================")d.show_patient_list("Dhaka")print("3.=========================================================")d.show_patient_list("Rajshahi")print("4.=========================================================")d.add_patients("Narayanganj Naruto…Question: 3Implement the design of the Ironman and DoctorStrange class derived from Avengers class so that the following code generates the output below:class Avengers: numberOfAvengers = 0 def __init__(self, name = None): self.name = name print('Welcome to Multiverse!') if self.name == None: print('Who is your favourite Super Hero?') else: print(f'{self.name} is your favourite Super Hero!') def hasSuperPower(self): print('All Avengers have super powers.') def fightThanos(self): return 'No avenger can fight Thanos'#Write your code here#-------------------------------------------------------------------------------------print('1.===============================')print('Number of Avengers:', Avengers.numberOfAvengers)print('2.===============================')a1 =…Using classes and arrays, the team will develop a set of functions for an online shopping system. The system is represented by the following structure: 1- Class Item having the following private attributes: (ID, name, quantity, price) and the following public methods:- Constructors (default, parameterized, and copy)- Setters & Getters- Operator overloading for the ==, +=,-=, >> and << operatorsNote that the ID member variable is not entered or read from the user. It is automatically set by the class as a serial ID starting with the first item of ID 1 and incrementing with every new object.2- Class Seller having the following private attributes: (name, email, items,maxItems), where items is a dynamic array of objects of type Item with the size maxItems. The class has the following public methods:- Constructor (parameterized)- Operator overloading for the insertion << operators- Add An Item.- This will take an Item object as a parameter:- If the item already exists…
- Using classes and arrays, the team will develop a set of functions for an onlineshopping system. The system is represented by the following structure:1- Class Item having the following private attributes: (ID, name, quantity, price) andthe following public methods:- Constructors (default, parameterized, and copy)- Setters & Getters- Operator overloading for the ==, +=,-=, >> and << operators Note that the ID member variable is not entered or read from the user. It isautomatically set by the class as a serial ID starting with the first item of ID 1 andincrementing with every new object.2- Class Seller having the following private attributes: (name, email, items,maxItems),where items is a dynamic array of objects of type Item with the size maxItems. Theclass has the following public methods:- Constructor (parameterized)- Operator overloading for the insertion << operators- Add An Item.- This will take an Item object as a parameter:- If the item already exists in the…Write a class definition that creates a class called leverage with one private data member, crowbar, of type int and one public function whose declaration is void pry(). Opp JavaAssignment Question : #include <iostream> using namespace std; class Animal { protected: int length, height; public: void set_values (int l, int h) { length = l; height = h; } virtual int cage_size (void) =0; }; A. Based on the above class definition, provide the derived classes below that will override the function cage_size from the base class Animal: i.Elephant, cage_size = 1.5 x length x height ii.Giraffe, cage_size = 2.5 x length x height B. Write the complete main () function that will create the object Elephant and Giraffe. Insert their length and height to calculate their cage_size. Note: A virtual function is a member function which is declared within a base class and is expected to be re-defined (overridden) by a derived class.
- Given the following class definition: class employee{public: employee(); employee(string, int, double); employee(int, double); employee(string); void setData(string, int, double); void print() const; void updatePay(double); int getNumOfServiceYears() const; double getPay() const;private: string name; int numOfServiceYears; double pay;}; Create a class parttime derived from the above class that includes private members payRate and hoursWorked of type double along with a constructor and the definition of a print function that prints out all information from the base and derived class. Provide a test program that would demonstrate the working parttime class. Note: You can assume all code is stored in a single file.Using classes and arrays, the team will develop a set of functions for an online shopping system. The system is represented by the following structure:1- Class Item having the following private attributes: (ID, name, quantity, price) and the following public methods:- Constructors (default, parameterized, and copy)- Setters & Getters- Operator overloading for the ==, +=,-=, >> and << operators Note that the ID member variable is not entered or read from the user. It is automatically set by the class as a serial ID starting with the first item of ID 1 and incrementing with every new object.2- Class Seller having the following private attributes: (name, email, items,maxItems), where items is a dynamic array of objects of type Item with the size maxItems. The class has the following public methods:- Constructor (parameterized)- Operator overloading for the >> and << operators- Add An Item.- This will take an Item object as a parameter:- If the item already…Analysis the following class definition and answer the following question. class Student{ private int id, age; protected float mark; int getAge (int a){ return a ; } protected void setMark (float m){ mark = m; } float result(){ return mark / 2; } } Which is the member variable of the class? a. setMark b. getAge c. result d. private e. age