p-Parking-Garage / CSC330_MidtermProj_Parking / Guest.cpp
Guest.cpp
Raw
// Guest Implementation File
//

#include <iostream>
#include "Person.h"
#include "Guest.h"
#include <string>
#include <fstream>

Guest::Guest() : Person()
{
	guestticket = 0;
	timereserved = 0;
}

Guest::Guest(string inName, string inLplate, int inTimeReserved, int inGuestTicket) : Person(inName)
{
	lplate = inLplate;
	timereserved = inTimeReserved;
	guestticket = inGuestTicket;
}

string Guest::getLicensePlate()
{
	return lplate;
}

int Guest::getTimeReserved()
{
	return timereserved;
}

int Guest::getGuestTicket()
{
	return guestticket;
}

void Guest::createGuestTxt(ofstream &guestData, Person &user)
{
	Guest tempU = *this; // Create a temporary tenant = the data referenced

	guestData.open("GuestData.txt", ios::out);
	guestData << "Guest #: " << tempU.getGuestTicket() << endl;
	guestData << "----------------" << endl;
	guestData << "Name: " << user.getName() << endl; // using composition
	guestData << "License Plate#: " << tempU.getLicensePlate() << endl;
	guestData << "Time Reserved: " << tempU.getTimeReserved() << " hours" << endl;
	guestData.close();
}

void Guest::print()
{
	cout << "Guest Name: " << Person::getName() << ", License Plate #: " << lplate << endl;
}