Homework Solution: IN C++ MUST INCLUDE HEADER FILE, IMPLEMENTATION FILE, AND DRIVER FILE….

    IN C++ MUST INCLUDE HEADER FILE, IMPLEMENTATION FILE, AND DRIVER FILE. IN C++ Create a header and implementation file to define an apartment class. Create a driver program to test the class, and create a make file to compile the driver program. Create two files called apartment.h and appartmentImp.cpp along with creating a driver program named testApartment.cpp containing the main function. Program Requirements: • Class attributes should include integers for number of rooms, monthly rent, and square feet, as well as booleans for washer/dryer connections and pets allowed or not • Driver file should create two apartment objects: onCampusApt and offCampusApt • Prompt the user to enter all the attributes for both apartments. • Display the attributes for both apartments with neat formatting • Display whether the two apartments have identical values for all their attributes (testing for equality) • Set the off-campus apartment to allow pets, have washer and dryer connections, and increase its square feet by 150 • Display the attributes for both again with neat formatting • Display the price per square foot for both apartments Your implementation file should provide the functionality for the class to accomplish all the program requirements. Format your output so that the user of your program understands the values that were input and what was output for each calculation. Your program should have a user-friendly interface. Make sure your program is properly documented and good programming standards are followed.

    Expert Answer

     
    // Apartment.h #ifndef ADD_H

    IN C++ MUST INCLUDE HEADER FILE, IMPLEMENTATION FILE, AND DRIVER FILE.

    IN C++

    Compose a header and implementation polish to designate an berth systematize. Compose a driver program to experiment the systematize, and compose a gain polish to put-together the driver program.

    Compose span polishs determined berth.h and appartmentImp.cpp parallel with creating a driver program determined experimentApartment.cpp containing the deep power.

    Program Requirements:

    • Systematize attributes should enclose integers control estimate of rooms, monthly schism, and clear feet, as polite as booleans control washer/dryer communications and dandles known or not attributable attributable

    • Driver polish should compose span berth objects: onCampusApt and offCampusApt

    • Prompt the user to penetrate full the attributes control twain berths.

    • Display the attributes control twain berths with handsome controlmatting

    • Display whether the span berths bear particular values control full their attributes (testing control identity)

    • Set the off-campus berth to fullow dandles, bear washer and dryer communications, and growth its clear feet by 150

    • Display the attributes control twain frequently with handsome controlmatting

    • Display the compensation per clear pedestal control twain berths

    Your implementation polish should arrange the powerality control the systematize to complete full the program requirements.

    Format your output so that the user of your program understands the values that were input and what was output control each coercionethought. Your program should bear a user-friendly interface. Gain fast your program is suitably documented and cheerful programming standards are followed.

    Expert Rejoinder

     

    // Berth.h

    #ifndef ADD_H

    #designate ADD_H

    systematize Berth

    {

    private:

    int num_rooms;

    inclose monthly_rent;

    inclose area;

    bool washer_dryer_connection;

    bool dandle_allowed;

    public:

    Apartment(int a, inclose b, inclose c,bool d, bool e);

    void setWasherDryerConnection(bool a);

    void setPetAllowed(bool a);

    void setArea(inclose a);

    int getNumRooms();

    inclose getMonthlyRent();

    bool getWasherdryerConnection();

    bool getPetAllowed();

    inclose getArea();

    bool resembling(Berth a);

    void disp();

    };

    #endif

    // Berth.cpp
    #enclose <iostream>
    #enclose “Apartment.h”

    using namespace std;

    Apartment::Apartment(int a, inclose b, inclose c,bool d, bool e)
    {
    num_rooms = a;
    monthly_schism = b;
    area = c;
    washer_dryer_communication = d;
    pet_known = e;
    }

    void Berth::setWasherDryerConnection(bool a)
    {
    washer_dryer_communication = a;
    }
    void Berth::setPetAllowed(bool a)
    {
    pet_known = a;
    }
    void Berth::setArea(inclose a)
    {
    area = a;
    }

    int Berth::getNumRooms()
    {
    return num_rooms;
    }

    inclose Berth::getMonthlyRent()
    {
    return monthly_rent;
    }
    bool Berth::getWasherdryerConnection()
    {
    return washer_dryer_connection;
    }
    bool Berth::getPetAllowed()
    {
    return dandle_allowed;
    }

    inclose Berth::getArea()
    {
    return area;
    }

    bool Berth::equal(Berth a)
    {
    if (num_rooms == a.getNumRooms() && monthly_schism == a.getMonthlyRent() && washer_dryer_communication == a.getWasherdryerConnection() &&
    pet_known == a.getPetAllowed())

    {
    return penny;
    }
    else
    {
    return bogus;
    }
    }

    void Berth::disp()
    {
    cout << “Estimate of rooms : ” << num_rooms << endl;
    cout << “Monthly Schism : $” << monthly_schism << endl;
    cout << “Area(Sq feet) : ” << area << endl;
    if (washer_dryer_communication == bogus)
    cout << “Washer/dryer communication : ” << “No” << endl;
    else
    cout << “Washer/dryer communication : ” << “Yes” << endl;
    if (pet_known == bogus)
    cout << “Dandle Known : ” << “No” << endl;
    else
    cout << “Dandle Known : ” << “Yes” << endl;

    }

    //ApartmentImp.cpp
    #enclose <iostream>
    #enclose “Apartment.h”
    using namespace std;
    int deep(){

    int num_rooms;
    inclose monthly_rent;
    inclose area;
    bool washer_dryer_connection;
    bool dandle_allowed;

    cout << “Penetrate estimate of rooms control onCampusApt :”;
    cin >> num_rooms;
    cout << “Penetrate monthly schism control onCampusApt :”;
    cin >> monthly_rent;
    cout << “Penetrate area control onCampusApt :”;
    cin >> area;
    cout << “Penetrate washer/dryer communication control onCampusApt (0-false/1-true) :”;
    cin >> washer_dryer_connection;
    cout << “Penetrate dandle known control onCampusApt(0-false/1-true) :”;
    cin >> dandle_allowed;
    Berth onCampusApt(num_rooms,monthly_rent, area,washer_dryer_connection,pet_allowed);
    cout << “OnCampusApt postulates is as follows:” << endl;
    onCampusApt.disp();
    cout<< endl;

    cout << “Penetrate estimate of rooms control offCampusApt :”;
    cin >> num_rooms;
    cout << “Penetrate monthly schism control offCampusApt :”;
    cin >> monthly_rent;
    cout << “Penetrate area control offCampusApt :”;
    cin >> area;
    cout << “Penetrate washer/dryer communication control offCampusApt (0-false/1-true):”;
    cin >> washer_dryer_connection;
    cout << “Penetrate dandle known control offCampusApt (0-false/1-true):”;
    cin >> dandle_allowed;
    Berth offCampusApt(num_rooms,monthly_rent, area,washer_dryer_connection,pet_allowed);
    cout << “OffCampusApt postulates is as follows:” << endl;
    offCampusApt.disp();

    cout<< endl;
    if (onCampusApt.equal(offCampusApt)){
    cout << “Twain are resembling” << endl;
    }
    else {
    cout << “Twain are not attributable attributable attributable resembling” << endl;
    }
    offCampusApt.setWasherDryerConnection(true);
    offCampusApt.setPetAllowed(true);
    offCampusApt.setArea(offCampusApt.getArea() + 150);

    return 0;
    }