Question: InStatePark.cpp: Implement the getter functionsgetParkName(),getEntranceFee(), andgetTrailMiles(). Implement the functionaddCamper(), which takes in a pointer to aPassport object as a parameter and adds it to the

  1. InStatePark.cpp:
    1. Implement the getter functionsgetParkName(),getEntranceFee(), andgetTrailMiles().
    2. Implement the functionaddCamper(), which takes in a pointer to aPassport object as a parameter and adds it to the end of the vectorcamperLog.

- In my current StatePark.cpp, addCamper function works properly, but others do not.

StatePark.cpp:

#include "Passport.h"

using std::string, std::vector;

// Mandatory // Constructor for StatePark class // TODO(student): implement constructor using member initializer list StatePark::StatePark(std::string parkName, double entranceFee, double trailMiles) : parkName(), entranceFee(), trailMiles(), camperLog({}) {}

// Mandatory // Getter for data member parkName string StatePark::getParkName() { // TODO(student): implement getter // return the parkName return parkName; }

// Mandatory // Getter for data member entranceFee double StatePark::getEntranceFee() { // TODO(student): implement getter return entranceFee; }

// Mandatory // Getter for data member trailMiles double StatePark::getTrailMiles() { // TODO(student): implement getter return trailMiles; }

// Mandatory // Adds a camper (represented by Passport object) to data member camperLog void StatePark::addCamper(Passport* camper) { INFO(camper) // TODO(student): implement function camperLog.push_back(camper); return; }

StatePark.h:

# ifndef _STATEPARK_H # define _STATEPARK_H

# include # include # include

# define INFO(X) std::cout << "[INFO] ("<<__FUNCTION__<<":"<<__LINE__<<") " << #X << " = " << X << std::endl;

class Passport;

class StatePark { private: std::string parkName; double entranceFee; double trailMiles; std::vector camperLog; public: StatePark(std::string parkName, double entranceFee, double trailMiles); std::string getParkName(); double getEntranceFee(); double getTrailMiles(); void addCamper(Passport* camper); double getRevenue();

Passport* getCamperAt(unsigned int i) { return camperLog.at(i); } };

# endif

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!