If a data that is to be defined for a class has the following characteristics:
then the data must be declared as
A) private constant member data
B) public constant member data
C) private constant static data
D) public constant static data
If a data that is to be defined for a class has the following characteristics: It...
Question 2 Answer the questions (i) to (iv) based on the following: class PRODUCT { int Code: char Item[20]; protected: float Qty; public: PRODUCT ( ); void GetIn( ); void Show( ): }; class WHOLESALER { int WCode; protected: char Manager[20]; public: WHOLESALER(); void Enter(); void Display (); }; class SHOWROOM : public PRODUCT, private WHOLESALER { char Name[20],City[20]; public: SHOWROOM(); void Input (); void View ( ); }; (i) Which type of Inheritance out of the following is illustrated...
1. What is output by the following code: ArrayList< Integer > a = new ArrayList< Integer >(); ArrayList b = a; a.add(new Integer(4)); b.add(new Integer(5)); a.add(new Integer(6)); a.add(new Integer(7)); System.out.println(b.size()); A)1 B)2 C)3 D)4 E)5 2. Assume the Student and Employee classes each extend the Person class. The Student class overrides the getMoney method in the Person class. Consider the following code: Person p1, p2, p3; int m1, m2, m3; p1 = new Person(); m1 = p1.getMoney(); // assignment 1...
Context of my question: I am reading C#. Trying to understand Static keyword. I understand that when Static is applied to a member of a class, it can only be modified by the class and not the class object references. I will take an example here. public class BluePrint { public static string BluePrintCreatorName; } If I need to know the BluePrintCreator's Name, I can call BluePrint.BluePrintCreatorName; But if a house that is created from the blueprint wants to...
in JAVA Which of the following attributes would be MOST appropriate for a class called Book, that represents a book in a library? libraryName, location, libraryHours title, author, typeOfBook pages, cost, shipping anything, anytime, anywhere Which of the following statements is FALSE regarding constructors? A constructor allows you to set up an object once it is instantiated. A constructor does not have a return type. A constructor must have the same name as the name of the class. You can...
1) Which of the following is the name of a local variable in the
Strange class below?
public class Strange{
public static final int MAX = 5;
public static void unknown(){
int number = 0;
for (int i = MAX; i >= 1; i--)
number += i * i;
System.out.println(number);
}
public static void main(String[] a){
unknown();
}
}
a) Strange
b)
int
c)
MAX
d)
number
e)
main
2) Which of the following is NOT a method of the...
At face value this class seems ok ... but really it's not... select all that are true public class Student private Personal Info information; public Personal Info getInfo() return this.information; This is just a standard getter ... nothing wrong with that. Returning the Personalinfo reference can open this Student to direct manipulation of their data. A more robust public interface should be created to protect and control access to Personalinfo information. This is technically encapsulated properly, but could have very...
C++ Define the class HotelRoom. The class has the following private data members: the room number (an integer) and daily rate (a double). Include a default constructor as well as a constructor with two parameters to initialize the room number and the room’s daily rate. The class should have get/set functions for all its private data members [3pts]. The constructors and the set functions must throw an invalid_argument exception if either one of the parameter values are negative. The exception...
C++
Please I need answer ASAP
i) Which of the following statements in a client program correctly initializes a variable day/ of type DateType to 10/12/90? A. Initialize(10, 12, 90); B. day1.month- 10; day1.day-12; day1.year-90; C. day1.Initialize(10, 12, 90); D. cin>>month>>day>>year; E. The client program cannot initialize the date. ii) The members of a class are public by default. A) True B) False iv) The member variables and functions declared following the word_(1.) are accessible only to the class's member...
C++
Question 1) Consider a class Point that models a 2-D point with x and y coordinates. Define the class point that should have the following Private data members x and y (of type int), with default values of 0 A constant ID of type int A private static integer data member named numOfPoints This data member should be o Incremented whenever a new point object is created. o Decremented whenever a point object is destructed. A default constructor An...