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
- A(n) ____________ is one instance or variable of a class.C# languageCreate a class for “Plane” having functionalities (methods) startengine(), fly() and land(). When ever engine starts it should reset the attribute TTK (Total travel kilometer) to zero and attribute Fuel to 100. On fly() it should add 10 kilometers if the Fuel attribute is greater than zero and decrement Fuel by 20.On land() it should print total distance covered. Write the code providing all necessary details. And then show working object of Plane in main().Programming Exercise 11-2 dateType.h file provided #ifndef date_H #define date_H class dateType { public: void setDate(int month, int day, int year); //Function to set the date. //The member variables dMonth, dDay, and dYear are set //according to the parameters //Postcondition: dMonth = month; dDay = day; // dYear = year int getDay() const; //Function to return the day. //Postcondition: The value of dDay is returned. int getMonth() const; //Function to return the month. //Postcondition: The value of dMonth is returned. int getYear() const; //Function to return the year. //Postcondition: The value of dYear is returned. void printDate() const; //Function to output the date in the form mm-dd-yyyy. bool isLeapYear(); //Function to determine whether the year is a leap year. dateType(int month = 1, int day = 1, int year = 1900); //Constructor to…
- Problem: Employee and ProductionWorker Classes Write a python class named ProductionWorker that is a subclass of the Employee class. The ProductionWorker class should keep data attributes for the following information: • Shift number (an integer, such as 1, 2, or 3)• Hourly pay rateThe workday is divided into two shifts: day and night. The shift attribute will hold an integer value representing the shift that the employee works. The day shift is shift 1 and the night shift is shift 2. Write the appropriate accessor and mutator methods for this class. Once you have written the class, write a program that creates an object of the ProductionWorker class, and prompts the user to enter data for each of the object’s data attributes. Store the data in the object, then use the object’s accessor methods to retrieve it and display it on the screen Note: The program should be written in python. Sample Input/Output: Enter the name: Ahmed Al-AliEnter the ID number: 12345Enter the department:…QI: (a) Find the errors in the following also explain what causes the error class Student int getid() private: int *id; int semester; string name; double cgpa; static int totalStudent; return *id; double getCgpa() return cgpas public: static int getSemester() Student () { id = new int(); name = ""; cgpa = e; totalStudent++ return semester; void setCgpa(int c) const cgpa = c; void setSection(char sec) Student (int *i,int s,string n, double c) id = i; section = sec; static int getTotalStudent() semester = s; name = ""; cgpa = e; totalstudent++; totalStudent =5; return totalStudent;Programming Language= PYTHON 1. Pet Class Write a class named Pet, which should have the following data attributes: • _ _name (for the name of a pet) • _ _animal_type (for the type of animal that a pet is. Example values are ‘Dog’, ‘Cat’, and ‘Bird’) • _ _age (for the pet’s age) The Pet class should have an _ _init_ _ method that creates these attributes. It should also have the following methods: • set_name This method assigns a value to the _ _name field. • set_animal_type This method assigns a value to the _ _animal_type field. • set_age This method assigns a value to the _ _age field. • get_name This method returns the value of the _ _ name field. • get_animal_type This method returns the value of the _ _animal_type field. • get_age This method returns the value of the _ _age field. Once you have written the class, write a program that creates an object of the class and prompts the user to enter the name, type, and age of his or her pet. This data should be stored as the object’s…
- Programming Language= PYTHON 1. Pet Class Write a class named Pet, which should have the following data attributes: • _ _name (for the name of a pet) • _ _animal_type (for the type of animal that a pet is. Example values are ‘Dog’, ‘Cat’, and ‘Bird’) • _ _age (for the pet’s age) The Pet class should have an _ _init_ _ method that creates these attributes. It should also have the following methods: • set_name This method assigns a value to the _ _name field. • set_animal_type This method assigns a value to the _ _animal_type field. • set_age This method assigns a value to the _ _age field. • get_name This method returns the value of the _ _ name field. • get_animal_type This method returns the value of the _ _animal_type field. • get_age This method returns the value of the _ _age field. Once you have written the class, write a program that creates an object of the class and prompts the user to enter the name, type, and age of his or her pet. This data should be stored as the object’s…True or false ? Assuming class Quiz { public: void TakeIt ( ); }; Quiz cs2b_quiz; Quiz * p_quiz = & cs2b_quiz; The syntax to invoke TakeIt ( ) member function using the pointer is: p_quiz->TakeIt ( );The distinction between a class's static and non-static data members is as follows: Give an example of real-world application where you think a static data member would be useful.
- clockType.h file provided //clockType.h, the specification file for the class clockType#ifndef H_ClockType#define H_ClockType class clockType {public: void setTime(int hours, int minutes, int seconds); //Function to set the time. //The time is set according to the parameters. //Postcondition: hr = hours; min = minutes; // sec = seconds // The function checks whether the values of // hours, minutes, and seconds are valid. If a // value is invalid, the default value 0 is // assigned. void getTime(int& hours, int& minutes, int& seconds) const; //Function to return the time. //Postcondition: hours = hr; minutes = min; // seconds = sec void printTime() const; //Function to print the time. //Postcondition: The time is printed in the form // hh:mm:ss. void incrementSeconds(); //Function to increment the time by one…please assist me c++ language 1, employee and productionwork classes design a class named employee. the class should keep the following information: employee name employee number hire date write one or more constructors, and the appropriate access and mutator functions, for the classes. next write a class named production worker that is derived from the employee class. the product ionworker class should have member variables to hold the following information shift (an array) Hourly pay rate (a double) the workday is divided into two shifts: day and night. the shift variable will hold an integer value representing the shift that the employee works. the day shift is shift 1, and the night shift is shift 2. write one or more constructors, and the appropriate accessor and mutator functions, for the class. Demonstrate the classes by writing a program that uses a production worker object . note: please submit 3 files employee.h productionWorker.h cpp file9. A university XYZ would like to have a system that will calculate grade for their students. Thus, you have been assigned to develop the system that requires student name and mark as an input to the system. The system will calculate the grade based on the following table. Grade Mark 0-39.9 40 - 59 60 - 70 71 - 80 81 - 100 F C A The example of the output as follows: : Jung Lee : 75 : Jeongmoon : 85.5 Enter a student name Enter a mark Enter a student name Enter a mark =====- ======= =====-== : Jung Lee : 75.0 Student name Mark Grade : B ===== =======-- ======== : Jeongmoon : 85.5 : A Student name Mark Grade ====