For the following code, which statement is not true?
Class Point {
private:
double y;
double z;
public:
double x;
};
a.z is available to objects of type Point declared outside the class.
b.x is available to objects of type Point declared outside the class.
c.x, y, and z are called members variables of the class.
d.The name of the class is Point.
Given the code below, What is the most accurate description of AwesomeClass(AwesomeClass & class2)?
class AwesomeClass
{
public:
AwesomeClass();
AwesomeClass(int x);
AwesomeClass(AwesomeClass & class2);
}
a.a friend function
b.a copy constructor
c.default constructor
d.overloaded construct
When a member function is defined (or implemented) outside of the class declaration, the function name must be qualified with the:
a.private access specifier
b.class name, followed by a single semicolon (:)
c.name of the first object
d.class name, followed by the scope resolution operator (::)
e.None of these
1A) Option "a" is not True
As z is a private member it is not available to the objects of type point declared outside the class
2A)Option "b" is most accurate description
As classname(classname & object name) is the syntax for copy constructor
3A) Option "d" is correct
when a member fuction is defined outside of the class declaration the function name must be qualified with class name followed by the scope resolution operstor ::
For the following code, which statement is not true? Class Point { private: double...
Multiple choice questions 1. A variable that is shared by all objects of a class is called_________? A.Static variable B. Const variable C.Member variable D. None of the above 2. Each object of a class has its own copy of the class's: A. member functions B. static member variables C. instance member variables D. A & C E. A & B 3. In a vector, which of the following statements is true? (can have multiple answers) a) Indexing vector access...
Please answer all the questions thank you
1) (Classes – 20 Points) Consider the following class declaration for Time to complete the questions below: DO NOT WRITE MORE THAN ASKED FOR. class Time private: int hours; int minutes; public: Time(); Time (int , int m = 0); void addMin(int m); void addHr(int h); void reset(int h = 0, int m = 0); Time operator+(const Time & t) const; Time operator-(const Time & t) const; Time operator*(double n) const; friend Time...
The following class class studentType { private: char firstName[25]; char lastName[25]; int testScore[4]; double averageScore; public: }; int main(){ studentType student[30]; } Write c++ code ti create a constructor of studentType to initialize the member variables. Also write function to input values of the member variables and print the values
In C++, A point class has the following definition: class Point{ private: int x; int y; public: Point(int, int); A vector has two points as a start point (x,y) and end point (x,y). Write the header file and implementation file of the Vector class containing constructor, other functions, and also a function returning length of Vector determined from start point and end point coordinates. Write also the client code.
In Java, Write a class encapsulating a restaurant,which inherits from Store. A restaurant has the following additional attributes: how many people are served every year and the average price per person. code the constructor, accessors, mutators, toString and equals method of the new subclass; also code a method returning the average taxes per year. You also need to include a client class to test your code for both the parent class and the subclass. Code for Store below(Super class aka...
he class definition for a Hank Account class, contains the following private data nembers: the name, account number (both are character arrays of 30 elements each) alance, and interest rate Cbolth are double). It also have the following public member unctions Bank AccountO: This function is the default constructor. deposito: subsequently adjusts the balance. (balance- balance + amt) withdrawo: This function is passed an amount to withdraw and subsequently adjusts the balance. (balance balance- amt). cale interestO: This function calculates...
Java code for the following inheritance hierarchy figure..
1. Create class Point, with two private
instance variables x and y that represented for the coordinates for
a point.
Provide constructor for initialising two instance variables.
Provide set and get methods
for each instance variable,
Provide toString method to return formatted
string for a point coordinates.
2. Create class Circle, its inheritance from
Point.
Provide a integer private
radius instance variable.
Provide constructor to
initialise the center coordinates and radius for...
Design a class Holiday that represents a holiday during the year. This class has three private data members: name: A string that represents the name of holiday. day: An integer that holds the day of the month of holiday. month: A string that holds the month the holiday is in. Write a default constructor that initializes each data member of class such that name with NULL, day with 0 and month with NULL Holiday() Write a constructor that accepts the...
Given the following date class interface: class date {private: int month;//1 - 12 int day;//1 - 28. 29. 30. 31 depending on month & year int year;//4-digit, e.g.. 2017 public: date();//Default constructor (investigate; find what it is used for)//Postcondition: the newly declared date object is initialized to 01/01/2000 date(int mm, int dd, int yyyy);//Second constructor//Postcondition: the newly declared data object is initialized to mm/dd/yyyy void setDate(int mm. int dd. int yyyy);//Postcondition: set the contents of the calling date object to...
Question: Write the Main class code for the following application. The first three classes are given below. Lottery This lottery app allows users to sign up for an account, choose a random number or two, and then win a certain amount of money if their chosen number matches the number that the game draws. The house keeps the cash proceeds if nobody wins. The app must repeatedly do the following: Allow the user to (1) Add Player Account (2) Play...