Hello all. I need some help with this program. Here are the requirements:
I want a kiosk style system for my movie theater.
I want customers to be able to purchase movie
tickets and/or food/drink items from this kiosk.
The customer will get a receipt he/she can bring
to get food/drink items, and also ticket for
any movie he/she wants to see.
The program should have one total that the customer
would pay when the customer is finished using
the kiosk:
example: I buy 2 movies tickets for a particular
movie and also buy 2 popcorns and 2 drinks.
Ideally, I would have a combo package where a
customer can have purchase tickets, food/drink
items for a discount.
The kiosk will accept credit cards only, therefore
you do not need to worry payment code in your
program
What I am looking for in your program:
Files for reading/displaying the available movies
Functions: should have functions for the movie
section, and also for food/drink items.
Here is the code I have so far:
#include<iostream>
#include<iomanip>
#include<fstream>
#include<string>
using namespace std;
int mpick(ifstream &iFile, string movie[])
{
int x=0;
while(iFile.good())
{
iFile >> movie[x];
x++;
}
return x;
}
double totalprice(string movie[], double total)
{
double number;
char selection;
int x=0;
for(int a=0;a<=3;a++)
{
cout << "All Movies are $6.99 per ticket." << endl;
cout << "Choose from the movies above:" << endl;
cin >> movie[x];
cout << "How many tickets for that movie: " << endl;
cin >> number;
total=6.99*number;
cout << "Would you like to purchase another movie? (Y or N)";
cin >> selection;
}
cout << "Total Price for movie tickets:$ " << total << endl;
return total;
}
int main()
{
const int x=100;
string movie[x];
char selection;
double number;
double movieCost=6.99;
double total=1;
int v;
cout << "Would you like to see a movie today? (Y or N)";
cin >> selection;
cout << endl;
while(selection == 'y' || selection == 'Y')
{
for(int b=0;b<v;b++)
cout << movie[b] << endl;
totalprice(movie,total);
}
if(selection == 'n' || selection == 'N')
{
cout << "Do you want any refreshments? (Y or N)";
cin >> selection;
cout << endl;
Ok so I know I do not have the refreshments menu in there but if I can get the movie list to work it will just be a rinse and repeat sort of thing.
My problem with this code is that for one the movie list is not reading from my file the second time I try to purchase a movie ticket. The first time it goes through the loop it list all of the movies but the times after that it does not display. Also, When I get done selecting my movies and I select 'N' to escape the loop it stays in the loop. Can someone shed some light onto this issue or maybe add some code to my program to get me back up and running. I have spent much time trying to fix it and am pulling my hair out. I can only use the libraries that I included in my code. Thanks!!