This is for my c++ class and im stuck.
Complete the Multiplex.cpp file with definitions for a function and three overloaded operators. You don't need to change anything in the Multiplex.h file or the main.cpp, though if you want to change the names of the movies or concession stands set up in main, that's fine.
Project Description: A Multiplex is a complex with multiple movie theater screens and a variety of concession stands. It includes two vectors: screenings holds pointers to MovieTheater objects, and foodcourt holds pointers to ConcessionStand objects. The main.cpp file creates dynamically allocated MovieTheater and ConcessionStand objects and uses the += operator to add them to the related Multiplex vector
________
Main.cpp
________
#include "Multiplex.h"
#include "ConcessionStand.h"
#include "MovieTheater.h"
#include <iostream>
using namespace std;
int main() {
Multiplex my_multiplex{"NEW YORK BAY CINEMAS"};
MovieTheater* theater1 = new MovieTheater{"Captain Marvel", 100};
MovieTheater* theater2 = new MovieTheater{"Apollo 11", 150};
MovieTheater* theater3 = new MovieTheater{"Starfish", 250};
MovieTheater* theater4 = new MovieTheater{"Five Feet Apart", 100};
MovieTheater* theater5 = new MovieTheater{"Never Grow Old", 150};
my_multiplex += theater1;
my_multiplex += theater2;
my_multiplex += theater3;
my_multiplex += theater4;
my_multiplex += theater5;
ConcessionStand* standA = new ConcessionStand{"Pizzeria"};
ConcessionStand* standB = new ConcessionStand{"Deli"};
ConcessionStand* standC = new ConcessionStand{"Popcorn"};
ConcessionStand* standD = new ConcessionStand{"Candy"};
ConcessionStand* standE = new ConcessionStand{"Hot Dogs"};
my_multiplex += standA;
my_multiplex += standB;
my_multiplex += standC;
my_multiplex += standD;
my_multiplex += standE;
cout << my_multiplex;
string usermovie;
cout << "\nWhat movie would you like to see? ";
getline(cin, usermovie);
if (my_multiplex.find_movie(usermovie) == true){
cout << usermovie << " is playing at " << my_multiplex.get_brandname() << "\n";
}
else {
cout << "Sorry! " << usermovie << " is not playing at " << my_multiplex.get_brandname() << " right now.\n";
}
}
Date.cpp
___________
#include <string>
#include <iostream>
#include <sstream>
#include <vector>
#include "Date.h"
Date::Date (unsigned int m, unsigned int d, unsigned int y){
setDate(m,d,y);
}
void Date::setDate(unsigned int m, unsigned int d, unsigned int y){
setMonth(m);
setDay(d);
setYear(y);
}
void Date::setMonth(unsigned int m){
if (m >= 1 && m <= 12){
month = m;
}
else{
std::cout << "invalid month " << m << "\n";
}
}
void Date::setDay(unsigned int d){
if (d >= 1 && d <= 31){
day = d;
}
else{
std::cout << "invalid day " << d << "\n";
}
}
void Date::setYear(unsigned int y){
year = y;
}
unsigned int Date::getMonth() const{
return month;
}
unsigned int Date::getDay() const{
return day;
}
unsigned int Date::getYear() const{
return year;
}
std::string Date::toString() const{
std::ostringstream output;
output << month << '/' << day << '/' << year;
return output.str();
}
_______________
Date.h
_______________
#include <string>
#ifndef DATE_H
#define DATE_H
class Date{
public:
Date (unsigned int = 1, unsigned int = 1, unsigned int = 2000);
void setDate(unsigned int m, unsigned int d, unsigned int y);
void setMonth(unsigned int m);
void setDay(unsigned int d);
void setYear(unsigned int y);
unsigned int getMonth() const;
unsigned int getDay() const;
unsigned int getYear() const;
std::string toString() const;
private:
unsigned int month{0};
unsigned int day{0};
unsigned int year{0};
};
#endif
______________
MovieTheater.cpp
______________
#include "MovieTheater.h"
#include "Ticket.h"
#include <vector>
#include <cstddef>
MovieTheater::MovieTheater (std::string movie, int capacity){
setMovieName(movie);
setCapacity(capacity);
setAvailableSeats(capacity);
}
// change values
void MovieTheater::setMovieName(std::string movie){
this->movie = movie;
}
void MovieTheater::setCapacity(int capacity){
if (capacity > 0){
this->capacity = capacity;
}
}
void MovieTheater::setAvailableSeats(int capacity){
if (capacity > 0)
{
this->availableSeats = capacity;
}
}
int MovieTheater::sellTicket(){
int number = -1; // number will either be valid ticket number or -1
if (availableSeats > 0){
Ticket* newTicket = new Ticket{movie, sellDate, screenTime};
number = newTicket->ticketNumber;
soldTickets.push_back(newTicket);
availableSeats--;
}
return number;
}
// get information
int MovieTheater::getCapacity() const{
return capacity;
}
int MovieTheater::getAvailableSeats() const{
return availableSeats;
}
int MovieTheater::getNumberSold() const{
return soldTickets.size();
}
std::string MovieTheater::getCurrentMovie() const{
return movie;
}
Ticket* MovieTheater::findTicket(int n) const{
for (int i = 0; i < soldTickets.size(); i++){
if (soldTickets[i]->ticketNumber == n){
return soldTickets[i];
}
}
return nullptr;
}
_______________
MovieTheater.h
______________
#include "Time.h"
#include "Date.h"
#include "Ticket.h"
#include <iostream>
#include <string>
#include <vector>
#ifndef MOVIE_THEATER
#define MOVIE_THEATER
class MovieTheater {
public:
// constructor
MovieTheater (std::string, int);
// change values
void setMovieName(std::string);
void setCapacity(int);
void setAvailableSeats(int);
int sellTicket();
// get information
int getCapacity() const;
int getAvailableSeats() const;
int getNumberSold() const;
std::string getCurrentMovie() const;
Ticket* findTicket(int) const;
private:
std::string movie;
int availableSeats{0};
int capacity{0};
Date sellDate{4, 12, 2019};
Time screenTime{20};
std::vector<Ticket*> soldTickets;
};
#endif
______________
Multiplex.cpp
_____________
#include "Multiplex.h"
#include <sstream>
/*
================
DEFINE THESE
================
*/
bool Multiplex::find_movie(std::string movie_search) const{
// complete definition
}
Multiplex& Multiplex::operator+=(MovieTheater* mt){
// complete definition
}
Multiplex& Multiplex::operator+=(ConcessionStand* cs){
// complete definition
}
std::ostream& operator << (std::ostream& out, const Multiplex& mp){
out << mp.print_header(); // keep to include "welcome" heading
// complete definition
}
/*
===============
ALREADY DEFINED
===============
*/
Multiplex::Multiplex(std::string name) :
brandname{name}
{}
std::string Multiplex::get_brandname() const{
return brandname;
}
std::string Multiplex::print_header() const{
std::ostringstream output;
std::string message = "WELCOME TO ";
int length = get_brandname().size() + message.size();
output << "\n";
for (int i = 0; i < length; i++){
output << '*';
}
output << "\n" << message << get_brandname() << "\n";
for (int i = 0; i < length; i++){
output << '*';
}
output << "\n";
return output.str();
}
_______________
Multiplex.h
_____________
#include "MovieTheater.h"
#include "ConcessionStand.h"
#include <vector>
#ifndef MULTIPLEX_H
#define MULTIPLEX_H
class Multiplex{
friend std::ostream& operator << (std::ostream&, const Multiplex&);
public:
Multiplex(){}
Multiplex(std::string); // take in brandname of Multiplex
std::string get_brandname() const;
std::string print_header() const;
bool find_movie(std::string) const;
Multiplex& operator+=(MovieTheater*);
Multiplex& operator+=(ConcessionStand*);
private:
std::string brandname{};
std::vector<MovieTheater*> screenings;
std::vector<ConcessionStand*> foodcourt;
};
#endif
_____________
Ticket.cpp
_____________
#include "Ticket.h"
#include "Date.h"
#include "Time.h"
// static members
int Ticket::nextTicket{101};
int Ticket::startTicket{101};
int Ticket::getNextTicket(){
return nextTicket;
}
int Ticket::getStartTicket(){
return startTicket;
}
// constructor
Ticket::Ticket(std::string m, Date d, Time t) :
movie{m}, showdate{d}, showtime{t}
{
ticketNumber = nextTicket;
nextTicket += 1;
}
___________
Ticket.h
___________
#include <string>
#include "Date.h"
#include "Time.h"
#ifndef TICKET_H
#define TICKET_H
// forward declaration
class MovieTheater;
class Ticket{
public:
static int getNextTicket();
static int getStartTicket();
// friend
friend class MovieTheater;
friend void kioskPrintTicket(MovieTheater, int);
private:
// private constructor
Ticket(std::string, Date, Time);
Date showdate;
Time showtime;
int ticketNumber;
std::string movie;
std::string status{"Active"};
// static data members
static int nextTicket;
static int startTicket;
};
#endif
_____________
Time.cpp
_____________
#include <string>
#include <sstream>
#include <iostream>
#include <iomanip>
#include "Time.h"
// constructor
Time::Time(int hour, int minute, int second){
setTime(hour, minute, second);
}
void Time::setTime(int h, int m, int s){
setHour(h);
setMinute(m);
setSecond(s);
}
void Time::setHour(int h){
if (h >= 0 && h < 24){
hour = h;
}
else{
std::cout << "\nInvalid hour value " << h << "\n";
}
}
void Time::setMinute(int m){
if (m >= 0 && m < 60){
minute = m;
}
else{
std::cout << "\nInvalid minute value " << m << "\n";
}
}
void Time::setSecond(int s){
if (s >= 0 && s < 60){
second = s;
}
else{
std::cout << "\nInvalid second value " << s << "\n";
}
}
unsigned int Time::getHour() const{
return hour;
}
unsigned int Time::getMinute() const{
return minute;
}
unsigned int Time::getSecond() const{
return second;
}
std::string Time::to24format() const{
std::ostringstream output;
output << std::setfill('0') << std::setw(2) << hour << ":" << std::setw(2) << minute << ":" << std::setw(2) << second;
return output.str();
}
std::string Time::toAMPMformat() const{
std::ostringstream output;
output << std::setfill('0') << std::setw(2) << ((hour == 0 || hour == 12) ? 12 : hour % 12) << ":" << std::setw(2) << minute << ":" << std::setw(2) << second << (hour < 12 ? " AM" : " PM");
return output.str();
}
___________
Time.h
___________
#include <string>
#ifndef TIME_H
#define TIME_H
class Time{
public:
// constructors
Time (int = 0, int = 0, int = 0);
// set functions
void setTime(int, int, int);
void setHour(int);
void setMinute(int);
void setSecond(int);
// get functions
unsigned int getHour() const;
unsigned int getMinute() const;
unsigned int getSecond() const;
// display functions
std::string to24format() const;
std::string toAMPMformat() const;
private:
unsigned int hour{0};
unsigned int minute{0};
unsigned int second{0};
};
#endif
I made a similar project regarding the same concept, you should have a look at this:
#include <iostream>
#include <fstream>
#include <conio.h>
#include <string>
#include <math.h>
#include <stdlib.h>
#include <stdio.h>
#include <process.h>
#include <time.h>
using namespace std;
//Class definition for ticket
class ticket{
public:
char name[10];
char cno[10];
} t; //object definition for ticket
// Class definition for card
class card : public ticket{ //inheritence for public ticket
public:
char address[50];
char emailid[20];
} v; //object definition for card
//Prototype Call for the functions definitions.
void pay(int);
void random();
void card();
//Main function
int main(){
system("CLS");
//Integer Declaration
int ent, a, b, N, x, cardid;
char ans;
//To display the system time.
//Using time header file
{time_t t = time(NULL);
tm* timePtr = localtime(&t);
cout << "Time of the computer presently:";
cout << "seconds= " << timePtr->tm_sec
<< endl;
cout << "minutes = " << timePtr->tm_min
<< endl;
cout << "hours = " << timePtr->tm_hour
<< endl;
cout << "day of month = " <<
timePtr->tm_mday << endl;
cout << "month of year = " <<
timePtr->tm_mon << endl;
cout << "year = " << timePtr->tm_year +
1900 << endl;
cout << "weekday = " <<
timePtr->tm_wday << endl;
cout << "day of year = " <<
timePtr->tm_yday << endl;
cout << "daylight savings = " <<
timePtr->tm_isdst << endl;
}
//An exit controlled loop (Do...While)
do{
//Menu
cout<<"\n\t\t\t
----------------------------------";
cout<<"\n\t\t\t Simple Movie
Ticket Booking System";
cout<<"\n\t\t\t
----------------------------------";
cout<<"\n\t\t\t\t Welcome
Customer!";
//Menu for the user
cout<<"\n\n\t\t\t\t <1>
Movie Timings";
cout<<"\n\t\t\t\t <2>
Recieving Ticket";
cout<<"\n\t\t\t\t <3>
For Information";
cout<<"\n\t\t\t\t <4>
DTCard Registration";
cout<<"\n\t\t\t\t <5>
Exit \n\n";
cout<<"\t\t\t\tEnter Your
Choice :"<<"\t";
cin>>ent;
switch(ent)
{
//Movie
Titles
case 1:
system("CLS");
cout<<"\n\n\t\t\t\tThe Shows
are :";
cout<<"\n\n\t\t\t\t 1. Avengers: Infinity War";
cout<<"\n\n\t\t\t\t 2. Antman And The Wasp";
cout<<"\n\n\t\t\t\t 3. Deadpool 2";
cout<<"\n\n\t\t\t\t 4. Venom";
cout<<"\n\n\t\t\t\t 5. Captain Marvel\n";
cout<<"\n\t\t\t\tEnter Your Choice :"<<"\t";
cin>>a;
cout<<"\n\n\t\t\t\t The Timings for the selected show
are:";
switch(a)
{
case 1:
system("CLS");
cout<<"\n\n\t\t\t\t Select the the
timings: ";
cout<<"\n\t\t\t\t 1.
0800";
cout<<"\n\t\t\t\t 2.
1300";
cout<<"\n\t\t\t\t 3.
1450";
cout<<"\n\t\t\t\t 4.
1800";
cout<<"\n\t\t\t\t 5.
2100";
cout<<"\n\t\t\t\t 6.
0100 \n";
//Timings of the show
cout<<"\n\n\t\t\t\t
Please select the timings: ";
cin>>b;
cout<<"\n\n\t\t\t\t
Enter your name: ";
cin>>t.name;
cout<<"\n\n\t\t\t\t
Enter your contact number: ";
cin>>t.cno;
cout<<"\n\n\t\t\t\t
Enter the number of tickets you want to purchase: ";
int x;
cin>>x;
pay(x);
cout<<"\n\n\n\t\t\t\t
Your ticket is here: ";
cout<<"\n\t\t\t\t Name
:"<<t.name;
cout<<"\n\t\t\t\t
Contact No :"<<t.cno;
cout<<"\n\t\t\t\t Show
timings :";
switch(b)
{
case 1: cout<<"0800";
break;
case 2: cout<<"1300";
break;
case 3: cout<<"1450";
break;
case 4: cout<<"1800";
break;
case 5: cout<<"2100";
break;
case 6: cout<<"0100";
break;
}
cout<<"\n\n\t\t\t\t Do you want to choose another
option(y/n)";
cin>>ans;
system("CLS");
break;
case 2:
system("CLS");
cout<<"\n\n\t\t\t\tSelect the the
timings:";
cout<<"\n\t\t\t\t 1.
0900";
cout<<"\n\t\t\t\t 2.
1100";
cout<<"\n\t\t\t\t 3.
1250";
cout<<"\n\t\t\t\t 4.
1500";
cout<<"\n\t\t\t\t 5.
2000";
cout<<"\n\t\t\t\t 6.
2200";
cout<<"\n\t\t\t\t
Please select the timings: ";
cin>>b;
cout<<"\n\n\t\t\t\t
Enter your name: ";
cin>>t.name;
cout<<"\n\t\t\t\t Enter
your contact number: ";
cin>>t.cno;
cout<<"\n\t\t\t\t Enter
the number of tickets you want to purchase: ";
cin>>x;
pay(x);
cout<<"\n\n\t\t\t\t
Your ticket is here:";
cout<<"\n\t\t\t\t Name
:"<<t.name;
cout<<"\n\t\t\t\t
Contact No :"<<t.cno;
cout<<"\n\t\t\t\tShow
timings :";
switch(b)
{
case 1: cout<<"0800";
break;
case 2: cout<<"1300";
break;
case 3: cout<<"1450";
break;
case 4: cout<<"1800";
break;
case 5: cout<<"2100";
break;
case 6: cout<<"0100";
break;
}
cout<<"\n\n\t\t\t\t Do
you want to choose another option(y/n)";
cin>>ans;
system("CLS");
break;
case 3:
system("CLS");
cout<<"\n\n\t\t\t\tSelect the the
timings:";
cout<<"\n\t\t\t\t 1.
0800";
cout<<"\n\t\t\t\t 2.
1300";
cout<<"\n\t\t\t\t 3.
1450";
cout<<"\n\t\t\t\t 4.
1800";
cout<<"\n\t\t\t\t 5.
2100";
cout<<"\n\t\t\t\t 6.
0100";
cout<<"\n\t\t\t\t
Please select the timings";
cin>>b;
cout<<"\n\t\t\t\t Enter
your name: ";
cin>>t.name;
cout<<"\n\t\t\t\t Enter
your contact number: ";
cin>>t.cno;
cout<<"\n\t\t\t\tEnter
the number of tickets you want to purchase: ";
cin>>x;
pay(x);
cout<<"\n\n\t\t\t\t
Your ticket is here: ";
cout<<"\n\t\t\t\t Name
:"<<t.name;
cout<<"\n\t\t\t\t
Contact No :"<<t.cno;
cout<<"\n\t\t\t\t Show
timings :";
switch(b)
{
case 1: cout<<"0900";
break;
case 2: cout<<"1300";
break;
case 3: cout<<"1450";
break;
case 4: cout<<"1800";
break;
case 5: cout<<"2100";
break;
case 6: cout<<"0100";
break;
}
cout<<"\n\n\t\t\t\t Do
you want to choose another option(y/n)";
cin>>ans;
system("CLS");
break;
case 4:
system("CLS");
cout<<"\n\n\t\t\t\tSelect the the timings:
";
cout<<"\n\t\t\t\t 1.
0800";
cout<<"\n\t\t\t\t 2.
1300";
cout<<"\n\t\t\t\t 3.
1450";
cout<<"\n\t\t\t\t 4.
1800";
cout<<"\n\t\t\t\t 5.
2100";
cout<<"\n\t\t\t\t 6.
0100";
cout<<"\n\t\t\t\t
Please select the timings: ";
cin>>b;
cout<<"\n\t\t\t\t Enter
your name: ";
cin>>t.name;
cout<<"\n\t\t\t\t Enter
your contact number: ";
cin>>t.cno;
cout<<"\n\t\t\t\t Enter
the number of tickets you want to purchase: ";
cin>>x;
pay(x);
cout<<"\n\n\t\t\t\t
Your ticket is here: ";
cout<<"\n\t\t\t\t Name
:"<<t.name;
cout<<"\n\t\t\t\t
Contact No :"<<t.cno;
cout<<"\n\t\t\t\t Show
timings :";
switch(b)
{
case 1: cout<<"0800";
break;
case 2: cout<<"1300";
break;
case 3: cout<<"1450";
break;
case 4: cout<<"1800";
break;
case 5: cout<<"2100";
break;
case 6: cout<<"0100";
break;
}
cout<<"\n\n\t\t\t\t Do you want to choose another
option(y/n)";
cin>>ans;
system("CLS");
break;
case 5:
system("CLS");
cout<<"\n\n\t\t\t\tSelect the the
timings:";
cout<<"\n\t\t\t\t 1.
0800";
cout<<"\n\t\t\t\t 2.
1300";
cout<<"\n\t\t\t\t 3.
1450";
cout<<"\n\t\t\t\t 4.
1800";
cout<<"\n\t\t\t\t 5.
2100";
cout<<"\n\t\t\t\t 6.
0100";
cout<<"\n\t\t\t\t
Please select the timings: ";
cin>>b;
cout<<"\n\t\t\t\t Enter
your name: ";
cin>>t.name;
cout<<"\n\t\t\t\t Enter
your contact number: ";
cin>>t.cno;
cout<<"\n\t\t\t\t Enter
the number of tickets you want to purchase: ";
cin>>x;
pay(x);
cout<<"\n \n\t\t\t\t
Your ticket is here: ";
cout<<"\n\t\t\t\t Name
:"<<t.name;
cout<<"\n\t\t\t\t
Contact No :"<<t.cno;
cout<<"\n\t\t\t\t Show
timings :";
switch(b)
{
case 1: cout<<"0800";
break;
case 2: cout<<"1300";
break;
case 3: cout<<"1450";
break;
case 4: cout<<"1800";
break;
case 5: cout<<"2100";
break;
case 6: cout<<"0100";
break;
}
cout<<"\n\n\t\t\t\t Do
you want to choose another option(y/n)";
cin>>ans;
system("CLS");
break;
}break;
case 2:
system("CLS");
cout<<"\n\nThank you for booking the
tickets online \n To print out the tickets please enter your
transaction ID in the portal";
//Finding
about a prebooked ticket
struct pre
{
int trsnid;
char name[10];
} p;
cout<<"\n Enter your transaction id\n
(Eg.last five digits of the transaction id) ";
cin>>p.trsnid;
cout <<"Enter your name";
cin>>p.name;
cout<<"Sorry to say that but you will need
to get the print out of the booking because our database shows no
booking by this name";
cout<<"\n Do you want to choose another
option(y/n)";
cin>>ans;
system("CLS");
break;
case 3: system("CLS");
cout<<"For further information about
movies you can download our Application(from the Google Play Store
or from the iOS App Store) or contact us at
01234567896523";
//Finding out more about our cinemas
cout<<"\n Do you want to choose another
option(y/n)";
cin>>ans;
system("CLS");
break;
case 4: system("CLS");
cout<<"Good Morning/Evnening \n Welcome to
start a new journey with our cinemas \n";
//card
membership
card();
cout<<"Thankyou. \n It will take us a week
for completing your registration for the card. \n Please see the
benefits of the card on the next page. -->";
char f;
cout<<"\n For selecting the page to go to
benefits say (y/n)\n";
cin>>f;
if(f=='y')
{
cout<<"Thank you for
registeration once again \n The priveleges provided with this card
are as follows:";
cout<<"\n 1. For every
purchase of a movie ticket you get 25 points(1point = 1Rs.) so
after 16 movies you get a free movie ticket.";
cout<<"\n 2. You are
provided with regular updates regarding the movie and the
showtimings.";
cout<<"\n 3. Anytime
prebook tickets for the upcoming movie and preffered seats will be
provided.";
}
cout<<"\n Do you want to choose another
option(y/n)";
cin>>ans;
if(ans=='y')
{
system("CLS");
break;
}
else
{
exit(0);
}
break;
case 5:
system("CLS");
cout<<"\n\t\t\t\tBrought To
You by code-projects.org\n\n\t\t\t\t";
system("PAUSE");
exit(0);
break;
}
}while(ans=='y');
}
//Function Declaration for Card
void card()
{
int cardid;
cout<<"\t\t\t\tWelcome to register for card
facility in our cinemas";
cout<<" \n\t\t\t\t Enter your name: ";
cin>>v.name;
cout<<"\t\t\t\tEnter your mobile number:
";
cin>>v.cno;
cout<<"\t\t\t\tEnter the address: ";
gets(v.address);
cout<<"\t\t\t\tEnter the mail id: ";
gets(v.emailid);
system("CLS");
int ID;
srand (time(NULL));
ID = rand() % 400000 + 4000000;
if (ID<0)
ID=(ID*-1);
cout<<"\t\t\t\tYour new card number is - :"
<<"\t"<<ID;
fstream fout;
fout.open("card.dat", ios::out|ios::app);
fout<<"\n Name
:"<<v.name<<"\n"<<"\n Mobile No.
:"<<v.cno<<"\n"<<"\n Address
:"<<v.address<<"\n"<<"\n Mail ID
:"<<v.emailid<<"\n"<<"\nCard
Number:"<<ID;
fout.close();
cout<<"\t\t\t\tThank you for the registeration
for the card. \n";
}
//Payment system for the interface
void pay(int a)
{
int normal, gold, amt[2],id;
time_t t = time(NULL);
//time setup
tm* timePtr = localtime(&t);
fstream fin;
fin.open("card.dat", ios::in|ios::app);
fin>>id;
cout<<"\t\tThank you for selecting the show. Now
we request you to select your type of seating \n\n\t\t\t\t 1.Normal
Class \n\t\t\t\t OR \n\t\t\t\t 2. Gold Class";
int c;
cin>>c;
if(c==1)
{
cout<<"\n\n\t\t\t\tYou
selected for a Normal show \n\n\t\t\t\t";
system("PAUSE");
system("CLS");
amt[1] = a * 400;
char final;
cout<<"\n\n\t\t\t\t Do you
have DTcard(y/n): ";
cin>>final;
if(final=='y')
{
int cid;
fin.read((char*)
&v, sizeof(v));
cout<<"\n\t\t\t\tEnter the card number[10 digits]: ";
if(cid==id)
{
amt[1]=amt[1] - (0.1*amt[1]);
};
}
cout<<"\n\t\t\t\tWant to pay
by Card(y/n): ";
char rep;
cin>>rep;
cout<<"\n\t\t\t\t"<<"Paying
:"<<amt[1]<<"\n";
if (rep=='y'||rep=='Y')
{
cout<<"\t\t\t\tName of the card holder: ";
char
n[10];
gets(n);
cout<<"\n\t\t\t\tEnter the card number: ";
char
Card[16];
gets(Card);
cout<<"\t\t\t\tExpiry(MM/YYYY)";
int
expirymm,expiryyy;
cin>>expirymm;
cout<<"\t\t\t\t/";
cin>>expiryyy;
while(expirymm<(timePtr->tm_mon) ||
expiryyy<(timePtr->tm_year + 1900)){
if(expirymm<=(timePtr->tm_mon))
{
cout<<"\t\t\t\tEnter the month again: ";
cin>>expirymm;
}
if(expiryyy<(timePtr->tm_year +
1900))
{
cout<<"\t\t\t\tPlease
enter a valid year: ";
cin>>expiryyy;
}
};
char
password[3],vh;
int h;
puts("\t\t\t\tEnter the CVV/CVV2: ");
while (1)
{
if (h<0)
h=0;
vh=getch();
if (vh==13)
break;
if (vh==8)
{
putch(NULL);
putch(NULL);
putch(NULL);
h--;
continue;
}
password[h++]=vh;
vh='*';
putch(vh);
};
password[h]=='\0';
}
}
else
{
cout<<"\n\n\t\t\t\tYou
selected for the Gold Class \n\t\t\t\t";
system("PAUSE");
system("CLS");
amt[2] = a * 700;
char final;
cout<<"\n\t\t\t\tDo you have
DTcard(y/n): ";
cin>>final;
if(final=='y')
{
int cid;
cout<<"\n\t\t\t\tEnter the card id number: ";
cin>>cid;
if(cid==id)
{
amt[1]=amt[1] - (0.1*amt[1]);
};
}
cout<<"\n\t\t\t\tWant to pay
by Card(y/n): ";
char rep;
cin>>rep;
cout<<"\n\t\t\t\t"<<"Paying
:"<<amt[2]<<"\n";
if (rep=='y'||rep=='Y')
{
cout<<"\t\t\t\tName of the card holder: ";
char
n[10];
gets(n);
cout<<"\n\t\t\t\tEnter the card number: ";
char
Card[16];
gets(Card);
cout<<"\n\t\t\t\tExpiry(MM/YY): ";
int expirymm,
expiryyy;
cin>>expirymm;
cout<<"\n/";
cin>>expiryyy;
while(expirymm<(timePtr->tm_mon) ||
expiryyy<(timePtr->tm_year + 1900)){
if(expirymm<=(timePtr->tm_mon))
{
cout<<"\n\t\t\t\tEnter the month again: ";
cin>>expirymm;
}
if(expiryyy<(timePtr->tm_year +
1900))
{
cout<<"\n\t\t\t\tPlease
enter a valid year: ";
cin>>expiryyy;
}
};
char
password[3],vh;
int h;
puts("\n\t\t\t\tEnter the CVV/CVV2: ");
while (1)
{
if (h<0)
h=0;
vh=getch();
if (vh==13)
break;
if (vh==8)
{
putch(NULL);
putch(NULL);
putch(NULL);
h--;
continue;
}
password[h++]=vh;
vh='*';
putch(vh);
};
password[h]=='\0';
}
};
}
This is for my c++ class and im stuck. Complete the Multiplex.cpp file with definitions for a fun...
This is for my c++ class and I would really appreciate the help, Thank you! Complete the definitions of the functions for the ConcessionStand class in the ConcessionStand.cpp file. The class definition and function prototypes are in the provided ConcessionStand.h header file. A testing program is in the provided main.cpp file. You don’t need to change anything in ConcessionStand.h or main.cpp, unless you want to play with different options in the main.cpp program. ___________________ Main.cpp ____________________ #include "ConcessionStand.h" #include <iostream>...
C++ edit: You start with the code given and then modify it so that it does what the following asks for. Create an EmployeeException class whose constructor receives a String that consists of an employee’s ID and pay rate. Modify the Employee class so that it has two more fields, idNum and hourlyWage. The Employee constructor requires values for both fields. Upon construction, throw an EmployeeException if the hourlyWage is less than $6.00 or over $50.00. Write a program that...
Please help fix my code C++, I get 2 errors when running. The code should be able to open this file: labdata.txt Pallet PAG PAG45982IB 737 4978 OAK Container AYF AYF23409AA 737 2209 LAS Container AAA AAA89023DL 737 5932 DFW Here is my code: #include <iostream> #include <string> #include <fstream> #include <vector> #include <cstdlib> #include <iomanip> using namespace std; const int MAXLOAD737 = 46000; const int MAXLOAD767 = 116000; class Cargo { protected: string uldtype; string abbreviation; string uldid; int...
my program wont run on my computer and im not understanding why. please help. #include<iostream> #include<iomanip> #include<string> #include "bookdata.h" #include "bookinfo.h" #include "invmenu.h" #include "reports.h" #include "cashier.h" using namespace std; const int ARRAYNUM = 20; BookData bookdata[ARRAYNUM]; int main () { bool userChoice = false; while(userChoice == false) { int userInput = 0; bool trueFalse = false; cout << "\n" << setw(45) << "Serendipity Booksellers\n" << setw(39) << "Main Menu\n\n" << "1.Cashier Module\n" << "2.Inventory Database Module\n" << "3.Report Module\n"...
2. In the following program an employee of a company is represented by an object of type employee consisting of a name, employee id, employee salary and the workday starting time. The starting time is a class time 24 object. Implement the class employee. Declaration of Employee and Time Classes /* File : employeetime.h Hlustrates composition of classes */ #ifndef EMPLOYEETIME.H #define EMPLOYEETIME.H #include <iostream> #include <string> using namespace std; class time 24 { private : int hour; int minute...
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...
Requirements: Finish all the functions which have been declared inside the hpp file. Details: string toString(void) const Return a visible list using '->' to show the linked relation which is a string like: 1->2->3->4->5->NULL void insert(int position, const int& data) Add an element at the given position: example0: 1->3->4->5->NULL instert(1, 2); 1->2->3->4->5->NULL example1: NULL insert(0, 1) 1->NULL void list::erase(int position) Erase the element at the given position 1->2->3->4->5->NULL erase(0) 2->3->4->5->NULL //main.cpp #include <iostream> #include <string> #include "SimpleList.hpp" using std::cin; using...
Write a C++ Program. You have a following class as a header file (dayType.h) and main(). #ifndef H_dayType #define H_dayType #include <string> using namespace std; class dayType { public: static string weekDays[7]; void print() const; string nextDay() const; string prevDay() const; void addDay(int nDays); void setDay(string d); string getDay() const; dayType(); dayType(string d); private: string weekDay; }; #endif /* // Name: Your Name // ID: Your ID */ #include <iostream>...
Write in C++ please In Chapter 10, the class clockType was designed to implement the time of day in a program. Certain applications, in addition to hours, minutes, and seconds, might require you to store the time zone. Derive the class extClockType from the class clockTypeby adding a member variable to store the time zone. Add the necessary member functions and constructors to make the class functional. Also, write the definitions of the member functions and the constructors. Finally, write...
Can anyone help me with my C++ assignment on structs, arrays and bubblesort? I can't seem to get my code to work. The output should have the AVEPPG from highest to lowest (sorted by bubbesort). The output of my code is messed up. Please help me, thanks. Here's the input.txt: Mary 15 10.5 Joseph 32 6.2 Jack 72 8.1 Vince 83 4.2 Elizabeth 41 7.5 The output should be: NAME UNIFORM# AVEPPG Mary 15 10.50 Jack 72 8.10 Elizabeth 41 7.50 Joseph 32 6.20 Vince 83 4.20 My Code: #include <iostream>...