I have written a C++ class called 'Birthday' and I want to write a method that can compare with another Birthday object and return true if it is a later date and false otherwise. What am I supposed to but into the parameters/method and what would I call in my main function to compare these objects? Here is what I have so far: #include <iostream>#include <string>#include <sstream>using namespace std;   class Birthday{private:int m_day;int m_month;string m_name;public:Birthday(){}Birthday(int month, int day, string name){m_month = month;m_day = day;m_name = name;}int getMonth(){return m_month;}bool isLater() //this is the method I am trying to write{if (m_month){return true;}else}string toString(){stringstream stream;stream << m_month << "/" << m_day << ": " << m_name;return stream.str();} };   int main(int argc, char* argv[]) { //main method Birthday();   return 0; }

Question

I have written a C++ class called 'Birthday' and I want to write a method that can compare with another Birthday object and return true if it is a later date and false otherwise. What am I supposed to but into the parameters/method and what would I call in my main function to compare these objects? Here is what I have so far:

#include <iostream>
#include <string>
#include <sstream>
using namespace std;

 

class Birthday
{
private:
int m_day;
int m_month;
string m_name;
public:
Birthday()
{
}
Birthday(int month, int day, string name)
{
m_month = month;
m_day = day;
m_name = name;

}
int getMonth()
{
return m_month;
}
bool isLater() //this is the method I am trying to write
{
if (m_month)
{
return true;
}
else
}
string toString()
{
stringstream stream;
stream << m_month << "/" << m_day << ": " << m_name;
return stream.str();
}

};

 

int main(int argc, char* argv[]) { //main method

Birthday();

 

return 0;

Expert Answer

Want to see the step-by-step answer?

Check out a sample Q&A here.

Want to see this answer and more?

Experts are waiting 24/7 to provide step-by-step solutions in as fast as 30 minutes!*

*Response times may vary by subject and question complexity. Median response time is 34 minutes for paid subscribers and may be longer for promotional offers.
Tagged in
Engineering
Computer Science

Related Computer Science Q&A

Find answers to questions asked by students like you.

Q: Assign secretID with firstName, a space, and lastName. Ex: If firstName is Barry and lastName is All...

A: To correct the given program code to assign the secretID as firstName,  space, and lastName, as show...

Q: In MS Access, to ensure that a promised date valued entered must a future point in time, whichvalida...

A: Now() function:The Now() function in Microsoft Access is used to return current date and time based ...

Q: My C++ program is supposed to check if a string input is in descending order. When I try to run it, ...

A: The given C++ code has few logical errors due to which it is not resulting the correct output. Revis...

Q: Use the Design Recipe to write a function called running_average that repeatedly asks the user to in...

A: DESIGN RECIPE:Based on the given problem use meaningful variable and function name. And perform the ...

Q: How can I fix that Traceback (most recent call last):  File "C:\Users\Richard Seegerer\Documents\Pyt...

A: Here you are trying to open a file name module.txt in reading only format. You are utilizing a relat...

Q: I need help with this problem for C++  If a linear search function is searching for a value that is ...

A: Often called sequential search is linear search. Linear search is a method within an array to check ...

Q: Write a program (IN C++) that will present the user with a main menu of options which the user can c...

A: Click to see the answer

Q: 2. (5.12 in 8e) answer each of the followig question. a) what does it mean to choose numbers "at ran...

A:  a) Choosing numbers at random means that any number can be selected and every number has an equal c...

Q: 1. Write a program in Python named filemaker.py that will be used to store the first name and age of...

A: This python program asks user to enter First name and Age of a number of friends. This program name ...

Q: First, launch NetBeans and close any previous projects that may be open (at the top menu go to File ...

A: Create a Java class MultiTable which uses 2 for-loops to create multiplication table.Outer for-loop ...

Q: Beacon frames in the frequency hopping spread spectrum variant of 802.11 contain the dwell time. Do ...

A: NO,  as we know the Bluetooth frame has dwell time of 625p sec for basic data rate in the frame its ...

Q: What are the differences between the top-down and bottom-up approaches to information security? Why ...

A: Top-down approach:Top-down approach is the division of system into subsystems which are done to gain...

Q: I am getting a floating point exception in my code. Which is to divide matrix 1 by matrix 2 (striaig...

A: Program Instructions:A floating-point exception occurs when an attempt is made to divide a number by...

Q: Create a complete ERD in Crow’s Foot notation that can be implemented in the relational model using ...

A: In the crow’s foot notation, entities are displayed in a box with the attributes listed below the na...

Q: What does it mean to choose numbers at random

A: RandomRandom is the word in which express that some item, number, quantity, etc. are chosen from the...

Q: This program is written in pseudocode."Design a program that asks the user to enter a store's sales ...

A: Program code #1:

Q: Given a nested list named NxN_table that represents a table with N rows and N columns, print each el...

A: Following Variables and functions has been used to solve this diagonal problem:Variables: N, i, tabl...

Q: For each of the following page replacement policies, list the total number of page faults and fill i...

A: Answer:a. LRU replacement:

Q: program3_3.py in pythonWrite a wholly creative quiz program that consists of three original question...

A: The code consists of three inputs such as int, float and string for wholly creative quiz program. 

Q: Selling a new vehicle pays a salesperson $1500. Selling a used vehicle pays a commission of 5% of th...

A: Following is the python program:locale module is imported to get currency formatting.Program prompts...

Q: Using DeMorgan's Law, write an expression for the complement of F if F(x,y,z) = xz' (xy + xz)+ xy'(w...

A: Demorgan’s law is a transformation rule in Boolean algebra. According to this rule,Negation of A OR ...

Q: Print "Censored" if userInput contains the word "darn", else print userInput. End with newline. Ex: ...

A: To add code segments in the below given program code, so that the code will print "Censored" if user...

Q: A palindromic prime is any prime number that is also a palindrome. For example, 131 is a palindromic...

A: ·         Create a main class and required variable to solve the problem of palindromic prime.·     ...

Q: A bag of cookies holds 40 cookies. The calorie information on the bag claims that there are 10 servi...

A: Program AlgorithmDeclare the required variable in the main().Get the input from the user for the num...

Q: What trade-offs are involved in building highly distributed data environments?

A: Trade-offs that are involved in building highly distributed data environments: 1) Availability,  2) ...

Q: Convert the following machine language instructions into assembly language, EXPLAIN ALL STEPS, assum...

A: 82B7DE:The given machine language instruction is 82B7DE.Its equivalent binary representation is 1000...

Q: Construct a truth table for the following: a) xyz + x(yz)' + x'(y+z) + (xyz)'b) (x + y')(x' + z')(y'...

A: Truth table:a. Given Boolean expression:F = xyz + x(yz)’ + x’(y + z) + (xyz)’

Q: Hi, I just finished the code for writing a java program that accepts ingredients for a recipe in cup...

A: Begin the pseudocode with the description/goal of the program.Indent loop and condition constructs p...

Q: Why is Big O preferred than Big Theta or Big Omega when analyzing algorithms?

A: Click to see the answer

Q: Evaluate cloud computing in relation to each of these four (4) criteria Dependable Manageable Adapta...

A: DescriptionEvaluating cloud computing in relation to the following four criteria’s:DependableDependa...

Q: Problem 1 consists of multiple parts. You should finish one part and ensure that it works before mov...

A: Hello. Since your question has multiple sub-parts, we will solve first three sub-parts for you. If y...

Q: what is mantissa and exponent values of 6.75

A: Convert decimal number (6.25)10 to binary:First, convert integer value (6)10 to binary:To obtain bin...

Q: What is the difference between hardware interrupts and software interrupts and give examples of situ...

A: Hardware interrupts:The physical signals either from within the microcontroller itself or may be fro...

Q: I have to code the game mastermind, but i only got halfway. I got the user input, 8 colors and the 3...

A:  solving the duplication problem:Create a temporary array named "temp" and initiate that array with ...

Q: Create a new Java application called "AtmSimDoLoop" (without the quotation marks) that simulates a s...

A: Following are the steps to create the java application AtmSimDoLoop that simulates the working of AT...

Q: I need help with Excel in my Intro to info systems. The thing i don't know how to do is this: It kee...

A: To solve this question user must know the definition of absolute reference:Absolute reference: An ab...

Q: How do I code this on python heres the problem  Use the Design Recipe to define a function count_val...

A: Programming instructions: Define the function count_value which takes the list and a value as an arg...

Q: A transitive dependency is equivalent to which of the following?A) A functional dependency between t...

A: Transitive dependencyA transitive dependency in a database is an indirect relationship between value...

Q: What was Networking?

A: Networking:Networking, also known as computer networking, is the practice of transporting and exchan...

Q: Write a Java program that prompts the user to enter a password and checks whether it is valid accord...

A: Create a main() method and a check_pass() to validate whether a password contains 8 characters or no...

Q: Create a class of type student .Members will include: name, gpa, rank (year) Make sure all data is p...

A: The name of the class is Student.All data is a private member of the class.All function is a public ...

Q: Create the Kmaps and then simplify for the following functions:a) F(x,y,z) = x'y'z' + x'yz + x'yz'b)...

A: Answer:a. K-map for the given Boolean expression:F = x'y'z' + x'yz + x'yz'Step 1: initially construc...

Q: b. The birthday paradox asks how many people should be in a room so that the chances are better than...

A: There are 365 days in a year so there is 365 day’s birthday.Probability for the same birthday is p(s...

Q: What role does database technology play in managing data as a business resource within an organizati...

A: Data resource management is applying software tools and information systems technologies such as dat...

Q: CAREER B VENT LYY a sqeo1 NON 0LO no o N aND Welcome | MYSAIL Oakland Un X Th Course: CSI-1420-43702...

A: This program is written in C language. Year is given as input and Easter Sunday's Month and day is c...

Q: Describe the activities that occur during project development.

A: Project development is a process in which resources are planned, organized and coordinated to achiev...

Q: Using a conditional expression, write a statement that increments numUsers if updateDirection is 1, ...

A: To create a conditional expression, by adding some code statements to the given program code. So, th...

Q: Programming Question: Write a program in MIPS assembly language that asks the users to enter a value...

A:  Code which is written in MIPS assembly language is shown below-

Q: In MS Access, to ensure that a grade must be either A, B, C, D or F, whichvalidation rule should be ...

A: Microsoft (MS) AccessMicrosoft access is a database management system from Microsoft that combines r...

Q: Python 3.7.4 Write the code to call the function named send_signal. There are no parameters for this...

A: To call the given function without parameter we need to write it as send_signal(). The following is ...