a) What is blank or uninitialized final variable? How to initialize blank final variable? b) What is the output of this program? class Base { protected void foo() {} } class Derived extends Base { void foo() {} } public class Main { public static void main(String args[]) { Derived d = new Derived(); d.foo(); } } c) What is the difference between "compile time polymorphism" and "run time polymorphism". Explain clearly with simple code examples.
Q: What is the output of the following C++ code? #include using namespace std; class BaseClass…
A: Code: #include <iostream> using namespace std; class BaseClass { protected: int…
Q: ointers or references, how should a programme call the same virtual function in different forms and…
A: Structural: Structural forms, otherwise called structural frameworks, are the instruments that…
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: Answer this in C++: In the Student.cpp file and Student.h file, build the Student class with the…
A: The answer is given below:-
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: 5. Which of the following concepts means adding new concepts to a program as it runs? a. Data hiding…
A: Answer: b. Dynamic loading
Q: Do all please. (a) Provide an example of a constructor method being overridden? (b) Describe Dynamic…
A: a. Constructor method overriding is not possible. Overriding occurs when the method with the same…
Q: Create a class: Doctor, with private data members: id, name, specialization and salary with public…
A: Lets see the solution.
Q: Write a c++ bank management program.And include these requirments: 400 line minimum (excluding…
A: #include<iostream>#include<fstream>#include<cctype>#include<iomanip>using…
Q: Q3: Suppose we have a class (for example name A). Write a program which consists of the following…
A: Here is the C++ Program:
Q: The following C++ code consists of an error. What is the cause of the error? class Human{ public:…
A: ERROR: cannot convert ‘Teacher*’ to ‘Human*’ in assignment h=&t; | ^~ |…
Q: a. Extend the definition of the class newString as follows:i. Overload the operators + and += to…
A: Programming language is missing in the question. So we will answer this program in C++ language. If…
Q: Analyse the imperative program code as shown in Listing 1. Adapt each of the programming methods…
A: To create a file in java, we need to import java.io.File package.File object is an abstract…
Q: 12- What is a null pointer? C++ 13- Every C++ class has a default constructor. (True or False) 14-…
A: To answer the above question you need a basic understanding of pointers, classes and templates in…
Q: Explain
A: To program : Swapping two numbers using friend function. Program code : #include<iostream.h>…
Q: Need code in C++. I have answer till part 7,please go through the code and correct it if you find…
A: A class is a user defined blueprint or prototype from which objects are created. It represents the…
Q: What am I doing wrong? I am supposed to do a class of Student, enter the functions and display all…
A: Task : C++ Code. The task is to debug the code and correct the errors.
Q: ?++What is the correct syntax of accessing a static member of a class in C class A public: static…
A: A::value
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: Considered the following code (excution begins in main ) What is the output of the code int i = 1,…
A: Solution: Given,
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: Static analyzer write code python read text and check Do the attributes (e.g., data type and size)…
A: The answer as given below;
Q: SOLVE IN "C#" Write c# equivalent statements for the following: There is a book library. Define…
A: using System; class book{ string name; string author_name; public book(String b, string a)…
Q: A reference parameter is a formal parameter that receives the memory address of its corresponding…
A: When we pass address in function it is then known as call by reference function.
Q: strictly use provide template for solution provided at end of a question.…
A: Coded using C++.
Q: Create a class calculate that uses two separate functions:-a function to multiply two float numbers…
A: Program Explanation- Create two float integers. Display the return type value. Declare the two…
Q: Make a class of School with Constructor and Destructor also add parameters rooms, staff, address and…
A: Program main.cpp #include <iostream> #include <string> #include "school.h" using…
Q: When does a compiler link a function to a function call? When it doesn't, what links them and how?
A: Since multiple questions are asked at once so first question will be answered so please upload…
Q: 5- When de we need to use private keyword in C++ class? 6- A derived class can be a base class for…
A: 5) When you need private keyword in c++ class 6) Derived class can be a base class for other class…
Q: c. Declare and initialize a static variable as counter in a function (increment it in every call)…
A: EXPLANATION First, create the static function, declare two counters. The first one will be static…
Q: The following program is written in a new progr and executes without any errors. Its output is the…
A: Sol: we have given one program pseudo code and based on such given code we will answer in the given…
Q: Write a Program in C++ which completes following requirements: a. Create a class, having a static…
A: #include <iostream>using namespace std; class IDGenerator{private: static int s_nextID; //…
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: Define a class template. When would a programmer want to use class templates?
A: Class template: Class templates are the specifications in order to generate classes based on the…
Q: Problem 1. Create a program Class and object where a Class is a Animal, with a method of dogBarking.…
A: The method of dogBarking is written using set and get commands. class Animal { private String…
Q: Write C++ program to demonstrate example of default constructoror no argument constructor. Write C++…
A: Given that Write C++ program to demonstrate example of default constructoror , parameterized…
Q: 1. A destructor function is called automatically when the object goes out of scope: I. the function…
A: Note: According to guidelines we are allowed to answer the first three questions please repost the…
Q: Exercise 10 Automatic type conversion is called coercion. For example, if an int variable and a…
A: Given: Automatic type conversion is called coercion. For example, if an int variable and a float…
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: Hello, I am having trouble with this homework question for my c++ course. Implement a Rational…
A: Task: Implement a Rational Number class with the following specifications. Data members a)…
Q: C ++ program with any idea. The program must contains at least 4 of these subjects ( Inheritance ,…
A: We are using these four topic in the program :- 1.Template 2.Exception Handling 3.File Stream,…
Q: Please Solve the Question in C++ as quickly as you can in 40 minutes. And do the same as asked in…
A: Algorithm: Start Create a template class SafeArray with data members size, Array Define a…
Q: Write the c++ program as follows, 1- Create a class Employee with id(int type), name(string type)…
A: getBest() function will check each and every employees points and updates the index
Q: thon program ; Implement the design of the Doctor and Engineer class derived from Person class so…
A: We need to implement the Doctor and Engineer code as per the given description.
Q: What is a type in c++ and does we need to create a new type
A: Each variable in c plus plus has type which denotes type of data stored in memory.
Q: an int named street_number a String named street_name and a String named state. Write three…
A: Java used to answer this question
Q: Local declarations are those that are kept in the memory of the computer; but, how exactly are they…
A: Encryption: Variables in a Local declaration are kept in the Stack data structure. The stack data…
Q: 1. A destructor function is called automatically when the object goes out of scope: I. the function…
A: NOTE: We’ll answer the first question since the exact one wasn’t specified. Please submit a new…
this is a java question complete 5 and provide right information and don't copy from internet please
Step by step
Solved in 5 steps with 5 images
- 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…In C++build a program to read that data with the following promptsa-) Create a class “name” with two data members: one for the first name (String) and one for the surname (String). The last name must be a pointer to char, the first name construct it as you prefer.b-) Create a grade class to store a subject name (String) and a grade (floating).c-) Create a class "student" that inherits from the class "name" and by composition can store the student's grades (consider that the maximum possible grades will be 6).d-) Create a group class to store the data of several students (consider a maximum of 10 students)e-) Develop a method that returns the average of the group of students.f-) Develop a method that returns the average of a student given his name and surname.g-) Develop a method that returns a list of students who have failed a subject (less than 6.0 points) given the name of the subject.h-) Develop a method that returns the first and last name of the student with the lowest…Problem 1: Java programComplete the Clothing class, the class should have the following instance variables, constructor(s) and instance methods:- An instance variable of type double named price.- An instance variable of type String named type.- An instance variable of type String named size.- A default “no-arg” constructor that sets the price to 29.9, the type to “TShirt” and the size to “Medium”. - An overloaded constructor that takes three parameters and set the instance variables accordingly. - A method named increasePrice that takes no parameters and returns no value, the method increases the instance variable price by 5.- An overloaded method increasePrice that takes a double parameter xand returns no value, the method increases the instance variable price by the value of parameter x.- A method named details which takes no parameters, returns no value, the method prints the Clothing item details in the format shown in the sample output.- Your output should look exactly the same…
- C++ Consider the following code: class A { public: virtual void printChar() { cout << 'A' << endl; } }; class B : public A { public: void printChar() { cout << 'B' << endl; } }; int main() { A a; B b; A *ptr; ptr = &a; ptr->printChar(); ptr = &b; ptr->printChar(); } Choose the best statement below: Consider the following code: class A { public: virtual void printChar() { cout << 'A' << endl; } }; class B : public A { public: void printChar() { cout << 'B' << endl; } }; int main() { A a; B b; A *ptr; ptr = &a; ptr->printChar(); ptr = &b; ptr->printChar(); } Choose the best statement below: a.) This code compiles, but has poor style. You shouldn't have a function printChar() defined in both classes. b.) This code compiles, and there is an example of polymorphism in the code. c.) This code compiles, and there is no example of…Describe how memory allocation is done to objects and also develop a C++ programfor employee class with following attributes such as Employee ID, Employee Name,Designation and Salary. Program should sort and display the list of employees inascending order of their salaries using object as a function argument. (Note:Employee ID must not be inputted by the user i.e., auto incremented.)Do all please. (a) Provide an example of a constructor method being overridden? (b) Describe Dynamic Binding as related to Class loading? (c) What is the role of a class loader? (d) What are two benefits of the Bytecode verification system?
- Answer this in C++: In the Student.cpp file and Student.h file, build the Student class with the following specifications: Private data members string name - Initialized in default constructor to "Louie" double gpa - Initialized in default constructor to 1.0 Default constructor Public member functions SetName() - sets the student's name GetName() - returns the student's name SetGPA() - sets the student's GPA GetGPA() - returns the student's GPA Ex. If a new Student object is created, the default constructor sets name to "Louie" and gpa to 1. The output of GetName() and GetGPA() before and after calling SetName("Felix") and SetGPA(3.7) is: Louie/1 Felix/3.7 main.cpp #include <iostream> #include <vector> #include "Student.h" using namespace std; int main() { Student student = Student(); cout << student.GetName() << "/" << student.GetGPA() << endl; student.SetName("Felix"); student.SetGPA(3.7); cout <<…using c++ define a class fruitType to store the following data about a fruit: Fruit name (string), color (string), fat (int), sugar (int), and carbohydrate (int). Declare a pointer of type fruitType to store the following data: Fruit name—banana, color—yellow, fat—1, sugar—15, carbohydrate—22. Write a member function, setFruitInfo to store data into a variable of fruitType. Write a member function, getFruitInfo to get data from a variable of fruitType. Write a member function, printFruitInfo to output data stored into a variable of fruitType. Use appropriate labels to identify each component. Test your solution by calling all funtions using the pointer.Complete the missing programming steps correctly:1. class Base {public void Print() {System.out.println("Base");}}class Derived_______ Base {public void Print() {i. System.out.println("Derived");}}class Main{public static void DoPrint( Base o ) {____________}public static void main(String[] args) {Base x = new Base();Base y = new Derived();___________________DoPrint(x);DoPrint(y);DoPrint(z);} }Output: BaseDerivedDerived2. Consider the following example code and generate the output. Give your explanation aboutgenerated output.class Base {public void foo() { System.out.println("Base"); }}class Derived extends Base {private void foo() { System.out.println("Derived"); }}public class Main {public static void main(String args[]) {Base b = new Derived();b.foo();}}3. Look at the below programming code and complete the missing parts to generate the givenoutput. Output: “Interface Method Implemented”interface Pet{_____________}class Dog implements Pet{public void…
- Write a Program in C++ which completes following requirements:a. Create a class, having a static function printing some information and invoke that method using scope resolution operator.b. Try to access non-static data members from static method and write in comments what happens.c. Declare and initialize a static variable as counter in a function(increment it in every call) and call it multiple times printing the change in valueKindly Solve this C++ question as per the instructions. Thank you for your help! Instructions: 1- Put the class definition in Flight.h and the implementation of the constructors and functions in Flight.cpp Implement the Flight.h and Flight.cpp so that class Flight contains: 4 private instance variables: Name of data type string, which describe the three electric vehicle charger types (AC975, DL521, and AC863). Destination of data type string that shows the final destination of that flight. Hour and Minute of data type int that show the departure time. A default constructor which sets all of the numeric instance variables to zero and the String instance variables to null. A constructor with 4 parameters that sets the 4 instance variables to the corresponding values passed. Implement an accessor method for each information (Flight name, Flight destination, and Flight Time) that will return the value of the instance variable. For example, the getX() method for the instance variables…strictly use provide template for solution provided at end of a question. -------------------------------------------- Write a program to calculate the total reward points.Strictly adhere to the Object-Oriented specifications given in the problem statement. All class names, member variable names, and function names should be the same as specified in the problem statement.A class VISACard has the following attributes. Access Specifiers Data type Variable protected string type protected double amount private int rewardPercentage Include the following method in VISACard class. Method Description public void ComputeRewardPoints() In this method, calculate and display the reward pointsbased on rewardPercentage in amount Formula:Reward points = amount * (rewardPercentage / 100)A derived class HPVISACard derived from VISACard class and overrides the following method. Method Description public void ComputeRewardPoints() In this method, calculate the reward point.3% of…