Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Introduction to Wireless and Mobile Systems

Authors: Dharma P. Agrawal, Qing An Zeng

4th edition

1305087135, 978-1305087132, 9781305259621, 1305259629, 9781305537910 , 978-130508713

More Books

Students also viewed these Programming questions