Answer 13- option F is correct. We make private data member for data integrity, data abstraction and information hiding but we can use them.
Answer-14- answer D is correct option. For a Copy constructor all these 3 lines fulfill criteria of copy constructor.
Answer -15: option C is correct. Abstract data types are the types which are used by programmer without knowing the implementation details.
Answer-16- option D is correct. This is called information hiding. Interface, testing and debugging, implementation are different. A,B,C wrong options.
Answer- 17- option B is correct. We use dynamic array when we don’t confirm the size of array if user want to increase size of array it will increase automatically.
Answer -18- option should be void output (ostream&outFile) it will accept either cout or a file stream object as its argument.
members of a class non-friends, non-members of a class All of the above be 13. Why...
Java Code: 2. Define a class ACCOUNT with the following members: Private members Acno of type int Name of type String Balance of type float Public members void Init) method to enter the values of data members void Show) method to display the values of data members void Deposit(int Amt) method to increase Balance by Amt void Withdraw(int Amt) method to reduce Balance by Amt (only if required balance exists in account) float RBalance() member function that returns the value...
please write the code in C++ 2 Base class File 3 Derived class PDF 3.1 Class declaration • The class PDF inherits from File and is a non-abstract class 1. Hence objects of the class PDF can be instantiated. 2. To do so, we must override the pure virtual function clone) in the base class • The class declaration is given below. • The complete class declaration is given below, copy and paste it into your file. . It is...
please write in c++. 4 Derived class JPG 4.1 Class declaration • The class JPG inherits from File and is a non-abstract class. 1. Hence objects of the class JPG can be instantiated. 2. To do so, we must override the pure virtual function clone() in the base class. • The class declaration is given below. class JPG : public File { public: JPG(const std::string& n, int n, int w, const double rgb()) : File(...) { // ... } *JPG()...
*** C++ *** Create a class called Student that contains a first name ( string) and an student id number (type long). 1. Include a member function called get_data( ) to get data from the user for insertion into the object, 2. Also include a function called display_data( ) that displays the student data. Then write a complete program that uses the class to do some computation. Your main function, main( ), should create a Dynamic Array of...
12. Consider C++ class. Which one of the following choices is NOT correct? A. Class instances can be static, stack dynamic, or heap dynamic. B. If static or stack dynamic, they are referenced directly with value variables. C. If stack dynamic, they are referenced through pointers. D. Stack dynamic instances of classes are always created by the elaboration of an object declaration. E. The lifetime of such a class instance ends when the end of the scope of its declaration...
Create an Item class, which is the abstract super class of all Items. Item class includes an attribute, description of type String for every item. [for eg. Book] A constructor to initialize its data member of Item class. Override toString() method to return details about the Item class. Create the ExtraCharge interface with the following details. Declare a constant RATE with value 0.25 Declare a method called calculateExtraCharge(), which returns a double value. Create the...
JAVA HELP (ARRAYS) Assignment Create a class named Module4 containing the following data members and methods (note that all data members and methods are for objects unless specified as being for the entire class) 1) Data members: none 2) Methods a. A method named displayContents that accepts an array of type int and prints their values to the b. A method named cemoveNegatives that accepts an array of type int, copies all its non-negative the new array should be the...
You will write the following files: mystack.h - contains the class definition for the mystack class. mystack.cpp - contains the definitions for member functions of the mystack class. inpost.cpp - contains your convert() function. inpost.h - contains the function prototype for convert() so that the main() can call it. Each of the files (with the exception of inpost.h) is described in more detail below. All header files should contain header guards to prevent them from being included multiple times in...
Write a full class definition for a class named Player , and containing the following members: A data member name of type string . A data member score of type int . A member function called setName that accepts a parameter and assigns it to name . The function returns no value. A member function called setScore that accepts a parameter and assigns it to score . The function returns no value. A member function called getName that accepts no...
Language is C++ Basic principles and theory of structured programming in C++ by implementing the class: Matrix Use these principles and theory to help build and manipulate instances of the class (objects), call member functions Matrix class implementation from the main function file and, in addition, the Matrix class must have its interface(Matrix.h) in a separate file from its implementation (Matrix.cpp). The code in the following files: matrix.h matrix.cpp matrixDriver.h Please use these file names exactly. Summary Create three files...