In c++ Using the class you wrote in prelab 10, write a program that a box office
ID: 3682753 • Letter: I
Question
In c++
Using the class you wrote in prelab 10, write a program that a box office cashier can use to enter the names, addresses, and number of tickets for a sequence of orders. The orders should be stored in a list. Your program should check that no one received more than four tickets, and that the same person does not submit multiple orders. When all the tickets have been ordered, your program is to generate a series of mailing labels (Name, address, number of tickets) that a clerk can use to fill the orders (hint: you may need to sort the list (according to name) and apply unique to delete same tickets).
This is the code from the pre-lab
#pragma once
#include <iostream>
#include <sstream>
using namespace std;
class address
{
public:
void set_street_name()
{
string str_name;
cout << "Enter your street Name ";
cin >> str_name;
street_name = str_name;
}
string get_street_name() const { return street_name; }
void set_street_number()
{
int str_num;
cout << "Enter your house number ";
cin >> str_num;
street_number = str_num;
}
int get_street_number() const { return street_number; }
void set_zipCode()
{
int zip;
cout << "Enter zipcode ";
cin >> zip;
zipCode = zip;
}
string get_city()
{
return city;
}
int get_zipCode()
{
return zipCode;
}
void set_city()
{
string cty;
cout << "Enter city ";
cin >> cty;
city = cty;
}
string get_city() const { return city; }
bool operator == (address& adr);
string to_string() const;
private:
int street_number;
string city;
int zipCode;
string street_name;
};
#include "address.h"
bool address:: operator == (address& adr)
{
if (street_name == adr.street_name && street_number == adr.street_number && city == adr.city && zipCode == adr.zipCode)
{
return true;
}
else
{
return false;
}
}
string address::to_string() const{
ostringstream sb;
sb << "Your address is " << street_number << " " << street_name << " " << city << " " << zipCode << endl;
return sb.str();
}
#pragma once
#include "address.h"
#include <iostream>
using namespace std;
class ticketOrder
{
public:
string get_person_name() const{return person_name;}
void set_person_name()
{
string name;
cout << "Enter your Name ";
cin >> name;
person_name = name;
}
void set_address(address adrs)
{
adr = adrs;
}
address get_address()
{
return adr;
}
bool operator == (ticketOrder& odr)
{
if (person_name == odr.person_name && adr.get_city() == odr.get_address().get_city() && adr.get_street_name() == odr.get_address().get_street_name()
&& adr.get_street_number() == odr.get_address().get_street_number() && adr.get_zipCode() == odr.get_address().get_zipCode())
{
return true;
}
else
{
return false;
}
}
private:
string person_name;
int tickets;
address adr;
};
Explanation / Answer
main.cpp
Tickets.cpp
Tickets.h
sample output:
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.