6.2. Write a program having a base class Student with data member rollno and member functions getnum() to input rollno and putnum() to display rollno. A class Test is derived from class Student with data member marks and member functions getmarks() to input marks and putmarks() to display marks. Class Sports is also derived from class Student with data member score and member functions getscore(0 to input score and putscore() to display score. The class Result is inherited from two base classes, class Test and class Sports with data member total and a member function display() to display rollno, marks, score and the total(marks + score).
Q: Create a class test with two private integer data members:x and y are one member of a function:…
A: Even though we use private and protected members to implement encapsulation, there are instances…
Q: Create a class Test with two private integer data members: x and y and one member function:…
A: PROGRAM CODE: #include <iostream> // include header file for input output…
Q: Write a C++ OOP program to define a class employee having members Emp-id, Emp-name, basic salary…
A: Write a C++ program that will use the OOPS concepts and follow the following conditions, define a…
Q: q1 A. Add a segment of code to the int main() function of the given employee program to create an…
A: We have to write a program Add a segment of code to the int main() function of the given employee…
Q: 6.3. An electricity board charges the following rates to domestic users to discourage large…
A: Program Approach: Include necessary header files required create a class electricity and declare…
Q: 5.3. Write the program, which has two classes one, is Date having members (day, month, year) and the…
A: As it is said that you are a beginner. I am writing a code with beginner level understanding. So, I…
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: Write C++ program to create class called human that has data members name, eye coior and age, also…
A: Solution
Q: Question3”, with protected data member: x (int) and with pure virtual function: “Task ()” [Returns…
A: #include <iostream>using namespace std; class Question3{ protected: int x; public:virtual…
Q: Write the following program in C++. 1. Create a class called Employee that includes attributes:…
A: Array indexing starts from 0 So, to access nth employee, we have to access the employee at index n-1
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: 3. Write a program to create a base class: "Question3", with protected data member: x (int) and with…
A: CODE:- #include <iostream>using namespace std;class Question3{ protected: int x;…
Q: Q5: Consider the following code. [14] class A { protected: double x; public: A() { coutShow(); Line…
A: a) List down the abstract and concrete classes? Ans: Note: If we do not override the pure virtual…
Q: 6.2. Write a program having a base class Student with data member rollno and member functions…
A: Program Approach: Include necessary header files for standard I/O. Create a class Student. Inside…
Q: Develop a program having a base class Student with data members rollno, name and Class define a…
A: Code: #include <iostream> using namespace std; class Student{ // this is the student class…
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 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: 2. Write a program to implement the following scenario The classes teacher, typist and officer is…
A: Code: #include <iostream> using namespace std;class staff{ private: string code,name;…
Q: Develop a program having a base class Student with data members rollno, name and Class define a…
A: Student is a base class and test should be derived from Student class which is concept of…
Q: Write a program to swap members of two private class A and B and print the final result using friend…
A: Program code: #include <iostream>using namespace std;class A { // Declare the…
Q: Create a class Test with two private integer data members: x and y and one member function:…
A: Objective: This program designs a class "Test" with two private data x and y of the type integer.…
Q: C++ a) Implement a class Animal. data members: type – an automatic variable (mammal, fish etc.)…
A: In C++ there are different storage classes available: auto register static extern mutable The auto…
Q: Kindly store employee details using class with python program [2/25, 05:28] Vishal Singh Rawat:…
A: Python: Python is a general purpose programming language developed by Guido Van Rossum in 1989.…
Q: c++ Implement a BankAccount class. BankAccount must have the following members: A member…
A: Code: #include<iostream>#include<stdio.h>#include<string.h> using namespace std;…
Q: Example 10-10 defined a class personType to store the name of a person. The member functions that we…
A: #include <iostream>using namespace std; class PersonType{ string firstName=""; string…
Q: 3. Write a program to create a base class: “Question3”, with protected data member: x (int) and with…
A: Given: 3. Write a program to create a base class: “Question3”, with protected data member: x(int)…
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: 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 find which data is greater than given data(assume the 2 dates in one single…
A: Code: include<stdio.h> static char daytab[2][13]={ {0,31,28,31,30,31,30,31,31,30,31,30,31},…
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: Create a class Test with two private integer data members: x and y and one member function:…
A: The private members of the class can be accessed only the member functions or the friend functions…
Q: T/F 4) Consider the following class hierarchy: Refer to Example Code Ch 09-1: A is a derived…
A: Consider the following class hierarchy A is a derived class of X. T/F
Q: Write a C++ program to overload unary (++) operator. More specifically, create a class Increment…
A: A C++ program is as follows, File name: “main.cpp” #include <iostream> using namespace std;…
Q: Create a class Test with two private integer data members: x and y and one member function:…
A: A function that exists outside of a class is known as a non-member function. A class presents the…
Q: 1.Write A Program To Define A Class “ Library ” Which May Have Data About I) Area In Square Feet, I
A: A square is a flat shape identified by four points at each of its four corners in one plane. A…
Q: Write a program in the C++ language to create a class Rectangle with two member integer variables…
A: Write a program in the C++ language to create a class Rectangle with two member integer variables…
Q: Write a program having a base class Student with data member rollno and member functions getnum() to…
A: #include <iostream>class Student{public: int rolno{0}; virtual void getnum() { std::cout…
Q: 2. Define a class Math in C++ that has two integer public members x,y and also, define a class…
A: Define a class Math in C++ that has two integer public members x,y and also, define a class member…
Q: 2. Write a C++ program to find the which date is greater than given date (Assume the 2 dates in one…
A: Include the header files Create a class called Day Declare the data members as date,month, and year…
Q: Example 5: Write a program to use a model of employee class (its data are: name, age, and…
A: 1. define class with datamembers. 2. for input method prompt user for input store to datamembers 3.…
Q: c++ Build a class Sale with private member variables double itemCost; // Cost of the item double…
A: 1. declared Sale class then created default constructor with value zero. 2. created parameterized…
Q: 10. Write the definitions of the member functions of the class a. calendarType (designed in…
A: Solution:
Q: 3- Write a program to implement a class "student" with the following members. Name of the student.…
A: As per the requirement program is developed. Note: In the question programming language is not…
Q: Write a program to create a class Triangle with three member integer variables side1, side2, and…
A: Write a program to create a class Triangle with three-member integer variables side1, side2, and…
Q: Hello, I am having trouble with this homework assignment for C++ (See below for the output) 4.…
A: Solution: Given: Given the implementation steps in the question, Implement a Person class. Dynamic…
Q: Create a class test with two private integer data members:x and Y and one member function:getdata ()…
A: #include <iostream> using namespace std;class test { private: //priate x,y int x;…
Q: Write a program in the C++ language to create a class Triangle with three member integer variables…
A: #include <iostream> #include <bits/stdc++.h> using namespace std; class…
Q: Write a program having a base class Student with data member rollno and member functions…
A: Program Explanation: 1) Implement the header file. 2) Put the integer name. 3) Then, enter the roll…
Q: In C++,Create a class Test with two private integer data members: x and y and one member function:…
A: C++ code for the given scenario is as follows: #include <iostream>using namespace std; class…
Q: 6.1. Write a program having a base class Student with data members rollno, name and Class define a…
A: Introduction of the Program: The C++ program has one base class name Student and this class has two…
Trending now
This is a popular solution!
Step by step
Solved in 3 steps with 1 images
- Write a program having a base class Student with data member rollno and member functions getnum() to input rollno and putnum() to display rollno. A class Test is derived from class Student with data member marks and member functions getmarks() to input marks and putmarks() to display marks. Class Sports is also derived from class Student with data member score and member functions getscore() to input score and putscore() to display score. The class Result is inherited from two base classes, class Test and class Sports with data member total and a member function display() to display rollno, marks, score and the total(marks + score). SUBJECT: Object Oriented Programming Write Code in C++Q3: Write a program in C++ using OOP to create a class (A) , that contain integer number(x) , contain the iilnction (FACT) to calculate the factorial of (x!)and create a class (B) , that contain integer number (n ) , contain the functions (POWER),to calculate ( .xü).-Illen create a Class (C) , with public visibility mode inherit from class (A)and public visibility mode inherit from class (B),contain the tunction that find10.11 C++ The base class Pet has protected data members petName, and petAge. The derived class Cat extends the Pet class and includes a private data member 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() function. Ex. If the input is: Dobby 2 Kreacher 3 Scottish Fold the output is: Pet Information: Name: Dobby Age: 2 Pet Information: Name: Kreacher Age: 3 Breed: Scottish Fold
- Q5: Consider the following code. [14]class A{protected:double x;public:A(){ cout<<"Constructor of Class A"<<endl; }void Display(){cout<<"Function Display of Class A"<<endl;}virtual void Print(){cout<<"Function Print of Class A";}virtual void Show()=0;}; class B:public A{protected:double y;public:B(){cout<<"Constructor of Class B"<<endl;}void Display(){cout<<"Function Display of Class B"<<endl;}void Show(){cout<<"Function Show of Class B"<<endl;}};class C:public A{public:C(){cout<<"Constructor of Class C"<<endl;}void Display(){cout<<"Function Display of Class C"<<endl;}};class D:public B{};void main(){Line 1: A *Ptr[3];Line 2: P[0]=new A;Line 3: Ptr[1]=new B;Line 4: Ptr[2]=new C;Line 5: Ptr[1]->Show();Line 6: Ptr[1]->Display();Line 7: Ptr[1]->Print();Line 8: Ptr[2]=new D;Line 9: Ptr[2]->Show();}a) List down the abstract and concrete classes?b) Find and correct the errors in the above…Question: 3 write python program ; Implement 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…5.6.2: Basic inheritance. Assign courseStudent's name with Smith, age with 20, and ID with 9999. Use the printAll() member method and a separate println() statement to output courseStudents's data. Sample output from the given program:Name: Smith, Age: 20, ID: 9999
- Write a C++ OOP program to define a class employee having members Emp-id, Emp-name, basic salary and functions accept() and display(). Calculate DA=25% of basic salary, HRA=800, I-tax=15% of basic salary. Display the payslip using appropriate output format.[2/25, 05:28] Vishal Singh Rawat: Kindly store employee details using class with python program [2/25, 05:28] Vishal Singh Rawat: There are 4 employees Details of all employee: Name: John , Designation: Manager , Salary: 80000 Name: Mike , Designation: Team Leader , Salary: 50000 Name: Derek , Designation: Programmer , Salary: 30000 Designation: Assistant , Salary: 25000 Name: RajHello, I am having trouble with this homework assignment for C++ (See below for the output) 4. Implement the following: a. Implement a Person class. b. Dynamic data member - name. c. Define a function call output. d. Implement big three. Use following main() to test your class.(Cannot change the given int main. Any alteration is not accepted)int main() {cout << endl;Person *p = new Person("David");p->output();Person p1(*p),p2;p1.output();p2 = p1;p2.output();delete p;cout << endl;return 0;} Output from main function above:Name:David==> (Person) copy constructor was called.Name:David==> (Person) Assignment operator was calledName:David==> (Person) Destructor was called==> (Person) Destructor was called==> (Person) Destructor was called
- c++ Implement a Class Book. Book shall have the following members: A member variable title of type std :: string.A member variable pages of the type unsigned int.A member variable current_page of type unsigned int.A parameterized constructor that takes title and pages as input parameters.A change_page function to scroll to a given page.A next_page function to scroll to the next page.A prev_page function to scroll to the previous page.A superimposed outflow operator (<<) that prints current_page.It is not allowed to scroll outside the pages of the book (0 <current_page <pages). The members must be encapsulated in accordance with the usual convention. Create goat and set functions as needed. Input follows the format: title pages start_page Output should have the following format:current_page repeated three times after calling change_page, next_page, prev_page in sequence, see comments below. Input Expected outputHitchhikers 191 100…Write a program in C++ using OOP, to create a class (student), that contain a private data (name, five grads). then create the following function: 1) (set_info()) to read the private data 2) (Print_info()) to Print student name and grades. 3) (Grade E()) as a friend function that calculate the grades average and print the student evaluation according to the following conditions: FAIL when (av=60 and av=70 and av 80 and av=90)Write a program to create a base class: Question3, with protected data member: x (int) and with pure virtual function: Task () [Returns no value and takes no argument]. Create a derived class of Question3 such as Sub1 (Derive features in public mode). In sub1, there is a member function in public section: get_data1 () to take input for x, and define Task () in this class to display the reverse of x. [Implement the above program by creating pointer to base in main () function and call the necessary functions].