Menu

[Solved]Gatecontrol Eight Functions Accessallowed Whose Input Argument Card Number Validates Acces Q37192478

GateControl has eight functions:

  1. AccessAllowed(), whose input argument is a cardnumber. It validates access and returns true if access is permittedand false if it is not. The attempted access, allowed or denied, isrecorded in a transaction log. The format of a transaction recordis defined in GateControl.hpp.

  2. AddAuthorization(), whosearguments are a card number, a cardholder name, and a time range (astart time / end time pair). The format of these times is the sameas described below in the Data and Time section. It returns aboolean success/failure status; failure (false) means the item wasalready present and couldn’t be added.

  3. DeleteAuthorization(), whose argument is a cardnumber. It returns a boolean success/failure status; failure(false) means the card was not found and couldn’t be deleted.

  4. ChangeAuthorization(), whose arguments are acard number, a cardholder name, and a time range. It changes thename and time range of an existing card. It returns a booleansuccess/failure status; failure (false) means the card was notfound and couldn’t be changed.

  5. GetAllAuthorizations(), which has one outputargument: the address of a vector to receive all of theauthorization records. It doesn’t return anything; the vector willbe cleared if there are no authorization records. The format of anauthorization record is defined in GateControl.hpp.

  6. GetCardAuthorization(), whose input argument isa card number. It has one output argument: the address of anauthorization record. It returns a boolean success/failure status;failure (false) means the card was not found. The format of anauthorization record is defined in GateControl.hpp.

  7. GetAllTransactions(), which has one outputargument: the address of a vector to receive the complete set oftransaction records. The format of a transaction record is definedin GateControl.hpp. If there are no transactions, the vector willbe cleared.

  8. GetCardTransactions(), whose input argument isa card number. It has one output argument: the address of a vectorto receive transaction records for the specified card. The formatof a transaction record is defined in GateControl.hpp. If there areno transactions, the vector will be cleared. It returns a booleansuccess/failure status; failure (false) means the card was notfound and no transactions could be found.

GateControl.cpp

#include   <iostream>
#include   “GateControl.hpp”

using namespace std;

extern   string   gCurrentDate;

extern   string   gCurrentTime;

bool   GateControl::AccessAllowed(CardNumbernumber)
{
   //to be completed

   return;
}

bool   GateControl::AddAuthorization(CardNumbernumber, const string& name,
   const string& startTime, const string&endTime)
{
   //to be completed
   return;
}

bool   GateControl::ChangeAuthorization(CardNumbernumber, const string& name,
   const string& startTime, const string&endTime)
{
   //to be completed
   return;
}

bool   GateControl::DeleteAuthorization(CardNumbernumber)
{
   //to be completed
   return;

}

void  GateControl::GetAllAuthorizations(AuthorizationVector&authorizationVector)
{

   AuthorizationIterator   iterator;

   //to be completed

   return;
}

void  GateControl::GetAllTransactions(TransactionVector&transactionVector)
{
   //to be completed

   return;
}

bool   GateControl::GetCardAuthorization(CardNumbernumber, Authorization& authorization)
{
   //to be completed

   return;
}

bool   GateControl::GetCardTransactions(CardNumbernumber,
   TransactionVector& transactionVector)
{
   //to be completed
   return;
}

GateControl.hpp

#pragma once

#include   <iostream>
#include   <map>
#include   <vector>

using namespace std;

typedef uint32_t   CardNumber;

typedef uint32_t   GateNumber;

struct   Authorization
{
   Authorization() { }

   Authorization(CardNumber number, const string&name, const string& startTime, const string& endTime)
       : number_(number), name_(name),startTime_(startTime), endTime_(endTime) { }

   CardNumber   number_;

   string       name_;

   string      startTime_;

   string      endTime_;
};

typedef map<CardNumber, Authorization>  AuthorizationMap;
typedef   AuthorizationMap::iterator      AuthorizationIterator;

typedef   vector<Authorization>  AuthorizationVector;

struct   Transaction
{
   Transaction() { }

   Transaction(CardNumber number, const string&name, const string& date, const string& time,
       bool accessAllowed)
       : number_(number), name_(name),date_(date), time_(time), accessAllowed_(accessAllowed) { }

   CardNumber   number_;

   string       name_;

   string       date_;

   string       time_;

   bool      accessAllowed_;
};

typedef   vector<Transaction>  TransactionVector;

class   GateControl
{
public:
   bool   AccessAllowed(CardNumber number);

   bool   AddAuthorization(CardNumbernumber, const string& name,
       const string& startTime, conststring& endTime);

   bool   ChangeAuthorization(CardNumbernumber, const string& name,
       const string& startTime, conststring& endTime);

   bool   DeleteAuthorization(CardNumbernumber);

   void  GetAllAuthorizations(AuthorizationVector&authorizationVector);

   void  GetAllTransactions(TransactionVector& transactionVector);

   bool   GetCardAuthorization(CardNumbernumber, Authorization& authorization);

   bool   GetCardTransactions(CardNumbernumber, TransactionVector& transactionVector);

private:
   AuthorizationMap   authorizationMap_;

   TransactionVector  transactionVector_;
};

Expert Answer


Answer to GateControl has eight functions: AccessAllowed(), whose input argument is a card number. It validates access and returns… . . .

OR


Leave a Reply

Your email address will not be published. Required fields are marked *