subject

C++ Consider the definition of the class dateType below:
a. Write the statement that includes a friend function named before in the
class dateType that takes as parameters two objects of type dateType
and returns true if the date represented by the first object comes before the
date represented by the second object; otherwise, the function returns false.
b. Write the definition of the function you defined in part a.

class dateType

{

public:

void setDate(int, int, int);

void setMonth(int);

void setDay(int);

void setYear(int);

void print() const;

int numberOfDaysPassed();

int numberOfDaysLeft();

void incrementDate(int nDays);

int getMonth() const;

int getDay() const;

int getYear() const;

int getDaysInMonth();

bool isLeapYear();

dateType(int month, int day, int year);

dateType();

private:

int dMonth;

int dDay;

int dYear;

};

a. In a class, why do you include the function that overloads the stream insertion operator, <<, as a friend function?

b. In a class, why do you include the function that overloads the stream extraction operator, >>, as a friend function?

If you define your own exception class, what is typically included in that class?

Suppose the exception class myException is defined as follows:
class myException
{
public:
myException()
{
message = "myException thrown!";
cout << "Immediate attention required!"
<< endl;
}
myException(string msg)
{
message = msg;
cout << "Attention required!" << endl;
}
string what()
{
return message;
}
private:
string message;
}
Suppose that in a user program, the catch block has the following form:
catch (myException mE)
{
cout << mE. what() << endl;
}
What output will be produced if the exception is thrown with the default constructor?
Also, what output will be produced if the exception is thrown with the
constructor with parameters with the following actual parameter?
"May Day, May Day"

Name three exception-handling techniques.

ansver
Answers: 1

Another question on Computers and Technology

question
Computers and Technology, 23.06.2019 14:30
Select the correct answer. peter has launched a website that features baby products. however, clients often find they are unable to access the website because the server is down. which feature of cybersecurity should peter focus on for his website? a. data authenticity b. data privacy c. data availability d. data integrity e. data encryption
Answers: 3
question
Computers and Technology, 23.06.2019 18:00
Which is a possible benefit of having a good credit history? having a checking account low interest rate on a car loan high interest rate on a credit card offer bankruptcy
Answers: 1
question
Computers and Technology, 24.06.2019 00:00
Which tool could be used to display only rows containing presidents who served two terms
Answers: 3
question
Computers and Technology, 24.06.2019 13:20
3. ranga ramasesh is the operations manager for a firm that is trying to decide which one of four countries it should research for possible outsourcing providers. the first step is to select a country based on cultural risk factors, which are critical to eventual business success with the provider. ranga has reviewed outsourcing provider directories and found that the four countries in the table that follows have an ample number of providers from which they can choose. to aid in the country selection step, he has enlisted the aid of a cultural expert, john wang, who has provided ratings of the various criteria in the table. the resulting ratings are on a 1 to 10 scale, where 1 is a low risk and 10 is a high risk. john has also determined six criteria weightins: trust, with a weight of 0.3; quality, with 0.2; religious, with 0.1; individualism, with 0.2; time, with 0.1; and uncertainity, with 0.1. using the factor-rating method, which country should ranga select? why? (2 points)
Answers: 3
You know the right answer?
C++ Consider the definition of the class dateType below:
a. Write the statement that includes...
Questions
question
Mathematics, 19.05.2020 16:15
question
History, 19.05.2020 16:15
question
Business, 19.05.2020 16:15
Questions on the website: 13722367