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
. . .
///
}
#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
. . .
///
}
Implement the ParkingLot.cpp with the given ParkingLot.hpp ********************************************************************* ParkingLot.hpp #pragma once #include <queue> #include "ClaimCheck.hpp" #include...
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 / 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 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...
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...
You are given a partial implementation of two classes. GroceryItem is a class that holds the information for each grocery item. GroceryInventory is a class that holds an internal listing of GroceryItems as well as the tax rate for the store. Your inventory could be 100 items it could be 9000 items. You won’t know until your program gets the shipment at runtime. For this you should use the vector class from the C++ standard library. I've completed the GroceryItem.h...
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 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 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...
How can we assess whether a project is a success or a
failure?
This case presents two phases of a large business transformation project involving the implementation of an ERP system with the aim of creating an integrated company. The case illustrates some of the challenges associated with integration. It also presents the obstacles facing companies that undertake projects involving large information technology projects. Bombardier and Its Environment Joseph-Armand Bombardier was 15 years old when he built his first snowmobile...