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++

    Produce a header and implementation improve to elucidate an chamber adjust. Produce a driver program to ordeal the adjust, and produce a produce improve to controlm the driver program.

    Produce brace improves denominated chamber.h and appartmentImp.cpp along with creating a driver program denominated ordealApartment.cpp containing the deep discharge.

    Program Requirements:

    • Adjust attributes should include integers control calculate of rooms, monthly fissure, and balance feet, as courteous as booleans control washer/dryer kindreds and caresss integralowed or not attributable attributable

    • Driver improve should produce brace chamber objects: onCampusApt and offCampusApt

    • Prompt the user to invade integral the attributes control twain chambers.

    • Display the attributes control twain chambers with handy controlmatting

    • Display whether the brace chambers entertain particular values control integral their attributes (testing control parity)

    • Set the off-campus chamber to integralow caresss, entertain washer and dryer kindreds, and growth its balance feet by 150

    • Display the attributes control twain frequently with handy controlmatting

    • Display the expense per balance pavement control twain chambers

    Your implementation improve should furnish the dischargeality control the adjust to terminate integral 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 vigilance. Your program should entertain a user-friendly interface. Produce certain your program is well documented and amiable programming standards are followed.

    Expert Reply

     

    // Chamber.h

    #ifndef ADD_H

    #elucidate ADD_H

    adjust Chamber

    {

    private:

    int num_rooms;

    embrace monthly_rent;

    embrace area;

    bool washer_dryer_connection;

    bool caress_allowed;

    public:

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

    void setWasherDryerConnection(bool a);

    void setPetAllowed(bool a);

    void setArea(embrace a);

    int getNumRooms();

    embrace getMonthlyRent();

    bool getWasherdryerConnection();

    bool getPetAllowed();

    embrace getArea();

    bool similar(Chamber a);

    void disp();

    };

    #endif

    // Chamber.cpp
    #include <iostream>
    #include “Apartment.h”

    using namespace std;

    Apartment::Apartment(int a, embrace b, embrace c,bool d, bool e)
    {
    num_rooms = a;
    monthly_fiscertain = b;
    area = c;
    washer_dryer_kindred = d;
    pet_undisputed = e;
    }

    void Chamber::setWasherDryerConnection(bool a)
    {
    washer_dryer_kindred = a;
    }
    void Chamber::setPetAllowed(bool a)
    {
    pet_undisputed = a;
    }
    void Chamber::setArea(embrace a)
    {
    area = a;
    }

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

    embrace Chamber::getMonthlyRent()
    {
    return monthly_rent;
    }
    bool Chamber::getWasherdryerConnection()
    {
    return washer_dryer_connection;
    }
    bool Chamber::getPetAllowed()
    {
    return caress_allowed;
    }

    embrace Chamber::getArea()
    {
    return area;
    }

    bool Chamber::equal(Chamber a)
    {
    if (num_rooms == a.getNumRooms() && monthly_fiscertain == a.getMonthlyRent() && washer_dryer_kindred == a.getWasherdryerConnection() &&
    pet_undisputed == a.getPetAllowed())

    {
    return gentleman;
    }
    else
    {
    return falsity;
    }
    }

    void Chamber::disp()
    {
    cout << “Calculate of rooms : ” << num_rooms << endl;
    cout << “Monthly Fiscertain : $” << monthly_fiscertain << endl;
    cout << “Area(Sq feet) : ” << area << endl;
    if (washer_dryer_kindred == falsity)
    cout << “Washer/dryer kindred : ” << “No” << endl;
    else
    cout << “Washer/dryer kindred : ” << “Yes” << endl;
    if (pet_undisputed == falsity)
    cout << “Caress Integralowed : ” << “No” << endl;
    else
    cout << “Caress Integralowed : ” << “Yes” << endl;

    }

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

    int num_rooms;
    embrace monthly_rent;
    embrace area;
    bool washer_dryer_connection;
    bool caress_allowed;

    cout << “Invade calculate of rooms control onCampusApt :”;
    cin >> num_rooms;
    cout << “Invade monthly fiscertain control onCampusApt :”;
    cin >> monthly_rent;
    cout << “Invade area control onCampusApt :”;
    cin >> area;
    cout << “Invade washer/dryer kindred control onCampusApt (0-false/1-true) :”;
    cin >> washer_dryer_connection;
    cout << “Invade caress integralowed control onCampusApt(0-false/1-true) :”;
    cin >> caress_allowed;
    Chamber onCampusApt(num_rooms,monthly_rent, area,washer_dryer_connection,pet_allowed);
    cout << “OnCampusApt grounds is as follows:” << endl;
    onCampusApt.disp();
    cout<< endl;

    cout << “Invade calculate of rooms control offCampusApt :”;
    cin >> num_rooms;
    cout << “Invade monthly fiscertain control offCampusApt :”;
    cin >> monthly_rent;
    cout << “Invade area control offCampusApt :”;
    cin >> area;
    cout << “Invade washer/dryer kindred control offCampusApt (0-false/1-true):”;
    cin >> washer_dryer_connection;
    cout << “Invade caress integralowed control offCampusApt (0-false/1-true):”;
    cin >> caress_allowed;
    Chamber offCampusApt(num_rooms,monthly_rent, area,washer_dryer_connection,pet_allowed);
    cout << “OffCampusApt grounds is as follows:” << endl;
    offCampusApt.disp();

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

    return 0;
    }