Implement in C++ language. Run it and show the screenshot. Write comments to understand the functionality. Also, make the program simple. Create a class representing anything you like. · Separate the...

1 answer below »
Pls write the comments and stuff for it.


Implement in C++ language. Run it and show the screenshot. Write comments to understand the functionality. Also, make the program simple. Create a class representing anything you like. · Separate the header and implementation files. · Include a few member variables, including at least one composite type (such as std::string or std::vector) · Create a default constructor · Create a constructor that requires only one parameter · Use member initialization lists for both constructors · Overload the + operator for your class · Overload the < operator="" for="" your="" class="" as="" a non-member function="" and="" make="" the="" function="" a="" friend="" within="" your="" class.="" ·="" create="" a="" method="" for="" your="" class="" that="" is const qualified.="" create="" main.cpp="" to="" demonstrate="" use="" of="" your="" class.="" ·="" create="" an="" instance="" of="" your="" class="" using="" the="" default="" constructor.="" add="" a="" comment="" to="" the="" statement="" that="" says="" "calling="" the="" default="" constructor".="" ·="" create="" three="" more="" instances="" of="" your="" class="" using="" functional="" form,="" assignment="" initialization,="" and="" uniform="" initialization.="" ·="" use="" the="" overloaded="" +="" operator="" to="" add="" two="" instances="" of="" your="" class="" together.="" ·="" use="" the="" overloaded="">< operator="" to="" print="" an="" instance="" of="" your="" class="" to="" the="" console="" ·="" note:="" just="" make="" a="" one="" simple="" class="" separate="" the="" header="" file="" and="" test="" your="" class="" in="" the="" main.="" follow="" the="" above="" requirement="" .="" ·="" a)="" create="" one="" class="" that="" has="" member="" data=""> v, and member data int sizeOfVector, · b) Create a default constructor and Use member initialization lists · c) Create a constructor that requires only one parameter(int size) and Use member initialization lists · d) write a method that use overloaded + operator to add two instances of your class together. Like: obj1 values of vector [0] = 12 obj2  values of vector [0] = obj1 value + obj2 value Sample: Date Date::operator+(const Date &otherDate) { Date sumDate { this->m_year + otherDate.m_year, (*this).m_month + otherDate.m_month, this->m_day + otherDate.m_day }; return sumDate; } · e) write a method that print vector value. for obj1 · f) write a method that Use the overloaded < operator="" to="" print="" an="" instance="" of="" your="" class="" to="" the="" console.="" for="" obj2=""   ="" sample:="" date="" d1(1,3,5);="" date="" d2(3,="" 4,="" 5);="" date="" d5="d1+d2;" std::cout="">< d5="">< std::endl;=""><(std::cout, d5);="" ·="" friend="" std::ostream&=""><(std::ostream&, const="" date&="" d);="" ·="" std::ostream&=""><(std::ostream& os,="" const="" date&="" d)="" {="" os="">< d.m_year="">< "/"="">< d.m_month="">< "/"="">< d.m_day; return os; } · g) create a method for your class that is const qualified. · like: · int date::getmonth() const {    return m_month; } d.m_day;="" return="" os;="" }="" ·="" g)="" create="" a="" method="" for="" your="" class="" that="" is const qualified.="" ·="" like:="" ·="" int="" date::getmonth() const {=""   ="" return="" m_month;="">
Answered Same DayMar 22, 2021

Answer To: Implement in C++ language. Run it and show the screenshot. Write comments to understand the...

Aditya answered on Mar 23 2021
143 Votes
#include "Vector.h"
Vector::Vector()
{
    cout << "Calling default constructor" << endl;
    sizeOfVe
ctor = 0;
}
Vector::Vector(int sizeOfvector)
{
    cout << "Calling parametrized constructor" << endl;
    this->sizeOfVector = sizeOfvector;
}
void Vector::addToVector(int value)
{
    if (sizeOfVector == 0)
    {
        v.push_back(value);
    }
    else
    {
        if (v.size() < sizeOfVector)
        {
            v.push_back(value);
        }
    }
    
}
void...
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here