Author the C++ class (both a .h file and a .cpp file) represented by the UML Cla
ID: 666343 • Letter: A
Question
Author the C++ class (both a .h file and a .cpp file) represented by the UML Class Diagram shown below. Create getter and setter methods shown below that interact with the private members with matching names. Use the Quiz 2 File Upload Area to send me your completed source code files.
ComputerVirus( string name, string dateDetected, string dateFixed );
string getName(); // getter methods
string getDateDetected();
string getDateFixed();
void setName( string name ); // setter methods
void setDateDetected( string date);
void setDateFixed( string date );
ComputerVirus( string name, string dateDetected, string dateFixed );
string getName(); // getter methods
string getDateDetected();
string getDateFixed();
void setName( string name ); // setter methods
void setDateDetected( string date);
void setDateFixed( string date );
string my_DateDetected; // the date the virus was first detected
string my_DateFixed; // the date the virus was fixed, patched or repaired
Explanation / Answer
public string getName()
{
return my_Name;
}
public string getDateDetected()
{
return my_DataDetected;
}
public string getDateFixed()
{
return my_DateFixed;
}
public void setName( string name )
{
my_Name = name;
}
public void setDateDetected( string date)
{
my_DateDetected = date;
}
public void setDateFixed( string date )
{
my_DateFixed = date;
}
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.