Question

Implement the ParkingLot.cpp with the given ParkingLot.hpp ********************************************************************* ParkingLot.hpp #pragma once #include <queue> #include "ClaimCheck.hpp" #include...

Implement the ParkingLot.cpp with the given ParkingLot.hpp

*********************************************************************

ParkingLot.hpp

#pragma once
#include <queue>

#include "ClaimCheck.hpp"
#include "Automobile.hpp"

struct ParkedCar {
Automobile vehicle_;
size_t claimNumber_;
};

class ParkingLot {
private:
std::queue<ParkedCar> parkedCars_; // aisles closed on one end

public:
ClaimCheck dropOff( const Automobile& vehicle );
Automobile pickUp ( const ClaimCheck& ticket );

size_t quantity();
};
*********************************************************************************

ParkingLot.cpp

#include <queue>
#include <stdexcept>
#include <string>

#include "ClaimCheck.hpp"
#include "ParkingLot.hpp"


/*******************************************************************************
** ParkingLot Member function definitions
*******************************************************************************/
ClaimCheck ParkingLot::dropOff( const Automobile& vehicle ) {
/// To be completed:
/// Create a claim check called ticket passing in the vehicle
. . .
///

/// To be completed:
/// Add the vehicle and the ticket's claim number to the collection of parked cars.
/// Hint: Create a ParkedCar and set its vehicle and claim number attributes, then push it on to the stack.
. . .
///

return ticket;
}


Automobile ParkingLot::pickUp( const ClaimCheck& ticket ) {
/// To be completed:
/// Move cars from the front of the queue to the back of the queue until you
/// find the one you're looking for or until you looked at them all.
/// Hint: The vehicle you're looking for has a ticket claim number that matches the parked car's claim number.
. . .
///

/// To be completed:
/// If you reach this point, the vehicle you're looking for wasn't in the parking lot.
/// Optional: Throw an invalid argument exception (highly recommended but not required). Otherwise
/// print out an error message and return the ticket's vehicle.
. . .
///
}


size_t ParkingLot::quantity()
{
/// To be completed:
/// Return the number of parked cars that are currently in the parking lot
. . .
///
}

0 0
Add a comment Improve this question Transcribed image text
Answer #1

#PLEASE GIVE IT A THUMBS UP!

For completing the functions It would be better if you had provided the  data autommobile.hpp and claimcheck.hpp;

As, You havenot provided so, I am guessing that new claim number for every new vehicle is provided by the quantity function.

Automobile ParkingLot::pickUp( const ClaimCheck& ticket ) {

int counter=0;

while(counter< parkedCars_.size()){

ParkedCar pc=parkedCars_.deque;

if(ticket.claimNumber_ ==pc.claimNumber_){ // checked if given tickets claim numbers vehicle exists in parked cars

return pc.vehicle_ ;

}

else{

parkedCars_.enque(pc);

counter++;

}

}

cout<<"This ticket number vehicle do not exist"<<endl;

return ticket.vehicle; // if vehicle parameter exists in claimcheck class;



}

ClaimCheck ParkingLot::dropOff( const Automobile& vehicle ) {

ClaimCheck ticket;

ticket.claimNumber_=quantity(); // assuming claimCheck has claimNumber_ as an attribute

ParkedCar pc; // create a parked car

pc.vehicle=vehicle; // set its vehicle;

pc.claimNumber_=ticket.claimNumber_; // set its claim number attribute

parkedCars_.enque(pc); // pushed into queue

return ticket; // returned ticket
}

size_t ParkingLot::quantity()
{
return parkedCars_.size();
/// Return the number of parked cars that are currently in the parking lot
. . .
///
}

Add a comment
Know the answer?
Add Answer to:
Implement the ParkingLot.cpp with the given ParkingLot.hpp ********************************************************************* ParkingLot.hpp #pragma once #include <queue> #include "ClaimCheck.hpp" #include...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Please Implement ParkingLot.cpp below based off the completed Automobile Class and ClaimCheck class down below. Automobile.hpp...

    Please Implement ParkingLot.cpp below based off the completed Automobile Class and ClaimCheck class down below. Automobile.hpp #pragma once #include <iostream> #include <string> class Automobile { friend bool operator==( const Automobile& lhs, const Automobile& rhs ); friend std::ostream & operator<<( std::ostream& stream, const Automobile& vehicle ); private: std::string color_; std::string brand_; std::string model_; std::string plateNumber_; public: Automobile( const std::string & color, const std::string & brand, const std::string & model, const std::string & plateNumber ); }; bool operator!=( const Automobile& lhs, const...

  • This is assignment and code from this site but it will not compile....can you help? home...

    This is assignment and code from this site but it will not compile....can you help? home / study / engineering / computer science / computer science questions and answers / c++ this assignment requires several classes which interact with each other. two class aggregations ... Question: C++ This assignment requires several classes which interact with each other. Two class aggregatio... (1 bookmark) C++ This assignment requires several classes which interact with each other. Two class aggregations are formed. The program...

  • This is a c++ program. Use the description from Parking Ticket Simulator (listed below) as a basis, where you need to...

    This is a c++ program. Use the description from Parking Ticket Simulator (listed below) as a basis, where you need to create a Car class and Police Officer class, to create a new simulation. Write a simulation program (refer to the Bank Teller example listed below) that simulates cars entering a parking lot, paying for parking, and leaving the parking lot. The officer will randomly appear to survey the cars in the lot to ensure that no cars are parked...

  • using java: For this exercise, you will design a set of classes that work together to simulate a parking officer checkin...

    using java: For this exercise, you will design a set of classes that work together to simulate a parking officer checking a parked car issuing a parking ticket if there is a parking violation. Here are the classes that need to collaborate: • The ParkedCar class: This class should simulate a parked car. The car has a make, model, color, license number. •The ParkingMeter class: This class should simulate a parking meter. The class has three parameters: − A 5-digit...

  • I've posted 3 classes after the instruction that were given at start You will implement and...

    I've posted 3 classes after the instruction that were given at start You will implement and test a PriorityQueue class, where the items of the priority queue are stored on a linked list. The material from Ch1 ~ 8 of the textbook can help you tremendously. You can get a lot of good information about implementing this assignment from chapter 8. There are couple notes about this assignment. 1. Using structure Node with a pointer point to Node structure to...

  • Introduction Welcome to Rad.io, you've been hired to work on our music streaming app, think of...

    Introduction Welcome to Rad.io, you've been hired to work on our music streaming app, think of it as Spotify only more rad! You're in charge of handling our customer’s song list. When a user selects a playlist it will load into the list a number of songs. Users can skip to the next song, move to the previous, they can select a song to play next or select a song to add to the end of their list. Objective You...

  • Case Study 1: Drive-Thru Service Times @ McDonald's (McDonalds Drive-Thru Waiting Times spreadsheet) When you're on...

    Case Study 1: Drive-Thru Service Times @ McDonald's (McDonalds Drive-Thru Waiting Times spreadsheet) When you're on the go and looking for a quick meal, where do you go? If you're like millions of people every day, you make a stop at McDonald's. Known as "quick service restaurants" in the industry (not "fast food"), companies such as McDonald's invest heavily to determine the most efficient and effective ways to provide fast, high-quality service in all phases of their business. Drive-thru operations...

  • Comprehensive Income Tax Course: Module 1 4. Randy turned 16 last year and had his first...

    Comprehensive Income Tax Course: Module 1 4. Randy turned 16 last year and had his first summer job. Even though his parents are claiming him as a dependent he wants to file a return in order to get his refund. He receives his W-2 and decides he can do his own return using form 1040-EZ. Which of the following information is not found on a Form W-2? a) The taxpayer’s Social Security number b) The taxpayer’s wages, tips and other...

  • Can Technology Save Sears? Sears, Roebuck used to be the largest retailer in the United States, w...

    Can Technology Save Sears? Sears, Roebuck used to be the largest retailer in the United States, with sales representing 1 to 2 percent of the U.S. gross national product for almost 40 years after World War II. Since then, Sears has steadily lost ground to discounters such as Walmart and Target and to competitively priced specialty retailers such as Home Depot and Lowe’s. Even the merger with Kmart in 2005 to create Sears Holding Company failed to stop the downward...

  • I need help with my very last assignment of this term PLEASE!!, and here are the instructions: After reading Chapter T...

    I need help with my very last assignment of this term PLEASE!!, and here are the instructions: After reading Chapter Two, “Keys to Successful IT Governance,” from Roger Kroft and Guy Scalzi’s book entitled, IT Governance in Hospitals and Health Systems, please refer to the following assignment instructions below. This chapter consists of interviews with executives identifying mistakes that are made when governing healthcare information technology (IT). The chapter is broken down into subheadings listing areas of importance to understand...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT