can anyone of u help me for this program

Please support our C++ advertiser: Intel Parallel Studio Home
Reply

Join Date: Jun 2006
Posts: 1
Reputation: hanabyha is an unknown quantity at this point 
Solved Threads: 0
hanabyha hanabyha is offline Offline
Newbie Poster

can anyone of u help me for this program

 
0
  #1
Jun 26th, 2006
i have to make a program for cinema management system. here i include the question and the source code that i've made before.

question:
----------------------------------------------------------------------------
. Students are required to design a Cinema Management System program that can perform the following functions (this program should depict the online system of “Cinemaonline” referenced at http://www.cinemaonline.com.my). User must register as a registered customer to book or buy ticket via the system. Some of the basic operations and functions of the system are listed below:

- Add new records
a) Add customer records to a file (to include details of customer like Login, Password, Customer Name, IC, Contact No and Address).
b) Add booking records to a file (to include details like Booking Code, Customer Name, Customer’s IC, Movie Code, Movie Name, Movie Date and Time, and Credit Card No.)
c) Add new movies to a file (to include details like movie name, movie date and time, casts and synopsis of the movie).

- Delete or Cancel existing records
a) Cancel booking records
b) Delete customer records
c) Delete movie records

- Modify existing records
a) Modify booking details
b) Modify customer details
c) Modify movie details

- Display records
a) Customers should be able to see their own records (personal and booking records).
b) Admin should be able to see all the customer records (personal and booking records).

There should be two types of users: Customer and Admin. Users need to login before able to use the system. Use different files to store different information (Example: “movie.txt”, “customer.txt” and “booking.txt”). Use only text files in this project. Extra marks will be given for creativity. You can introduce your own rules as well (Example: customer only can book the ticket 2 days in advance).
-------------------------------------------------------------------------

And i only can do this source code.

  1. #include <iostream>
  2. #include <fstream>
  3. #include <iomanip>
  4. #include <string>
  5.  
  6. const int size = 300;
  7. using namespace std;
  8. int main();
  9. class Cinema{
  10. public:
  11. void viewTime();
  12. int selectCinema();
  13. void bookTicket(int CinemaType, int CinematNo,int cust);
  14. int seatDisp(int FlightNo);
  15. int findRecord(int FlightNo);
  16. Cinema()
  17. {
  18. int a,b,c;
  19. for(c=0;c<4;c++) // represents the flight number
  20. {
  21. for(a=0;a<6;a++) // represents row
  22. {
  23. for(b=0;b<10;b++) // represents column
  24. {
  25. CinemaSeatNo[a][b][c] = 0;
  26. }
  27. }
  28. }
  29. }
  30.  
  31. private:
  32. int CinemaSeatNo[6][10][4];
  33. int CinemaType;
  34. int CinemaNo;
  35. int totalTicBook;
  36. int cust;
  37. };
  38. class customer:public Cinema
  39. {
  40. public:
  41. void addCustomer();
  42. void dispCustomer();
  43. private:
  44. char name[size];
  45. char address[size];
  46. char telNo[size];
  47. int payment;
  48. };
  49. //------------------------------View Time---------------------------------------
  50. void viewTime()
  51. { int menu=1;
  52. int back;
  53. system("cls");
  54. cout << "\n\t^^^^^^^^^^^^^^^^^^^^ Available Cinema ^^^^^^^^^^^^^^^^^\n";
  55. cout << "\n\n\t\t 1.Pirates Of The Carribean 2\n";
  56. cout << "\t\t 2.tipah tertipu \n";
  57. cout << "\t^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n";
  58. cout << "\n\tEnter 0 to Exit From This Menu : ";
  59. cin >> back;
  60.  
  61. system("cls");
  62. }
  63. // --------------------------------insert cinema data---------------------------------
  64. int Cinema::selectCinema()
  65. {
  66. int menu1=0,menu2=0,
  67. CinemaNo; // cinemaSeatNo[a][b][x]
  68. system("cls");
  69. do
  70. {
  71. cout<<"\n\t*************** Please Enter Reservation Detail. ***************"
  72. <<"\n\nEnter Time Of Cinema.."
  73. <<"\n\t[1] : For Afernoon Cinema" // cinemaSeatNo[x][x][0 to 1]
  74. <<"\n\t[2] : For MidNight Cinema" // cinemaSeatNo[x][x][2 to 3]
  75. <<"\n\t[0] : To Quit From Reservation Menu\nEnter choice: ";
  76. cin>>CinemaType; // 1= Pirates Of The Carribean 2, 2=tipah tertipu
  77. // ------Check Type Of Cinema------
  78. switch(CinemaType)
  79. {
  80. case 1:
  81. do{
  82. cout<<"\n--- Afternoon Show Ticket Reservation ---"
  83. <<"\nEnter Cinema.."
  84. <<"\n\t[1] For Pirates Of The Carribean 2"
  85. <<"\n\t[2] For tipah tertipu"
  86. <<"\n\t[0] For Quit Menu\nEnter choice: ";
  87. cin>>CinemaNo;
  88. switch(CinemaNo)
  89. {
  90. case 1:
  91. case 2:
  92. case 3:
  93. CinemaNo=CinemaNo-1;
  94. cust=seatDisp(CinemaNo);
  95. bookTicket(CinemaType,CinemaNo,cust);
  96. menu2=1;
  97. menu1=2;
  98. break;
  99. case 0:
  100. menu2=1;
  101. break;
  102. default:
  103. cerr << "Invalid choice"<<endl<<endl;
  104. system ("pause");
  105. system("cls");
  106. }
  107. }while(menu2 !=1);
  108. break;
  109.  
  110. case 2:
  111. do{
  112. cout<<"\n--- Night Show Ticket Reservation ---"
  113. <<"\nEnter Flight.."
  114. <<"\n\t[4] For Pirates Of The Carribean 2"
  115. <<"\n\t[5] For tipah tertipu"
  116. <<"\n\t[0] For Quit Menu\nEnter choice: ";
  117. cin>>CinemaNo;
  118. switch(CinemaNo)
  119. {
  120. case 4:
  121. case 5:
  122. case 6:
  123. CinemaNo=CinemaNo-1;
  124. cust=seatDisp(CinemaNo);
  125. bookTicket(CinemaType,CinemaNo,cust);
  126. menu2=1;
  127. menu1=2;
  128. break;
  129. case 0:
  130. menu2=1;
  131. break;
  132. default:
  133. cerr << "Invalid choice"<<endl<<endl;
  134. system ("pause");
  135. system("cls");
  136. }
  137. }while(menu2 !=1);
  138. break;
  139. case 0:
  140. menu1=1;
  141. break;
  142. default:
  143. cerr << "Invalid choice"<<endl<<endl;
  144. system ("pause");
  145. system("cls");
  146. }
  147. }while (menu1 ==0);
  148. return (menu1);
  149. }
  150. // -------------------------------- booking ticket function --------------------------------
  151. void Cinema::bookTicket(int CinemaType, int CinemaNo, int customer)
  152. {
  153. int seatNo,
  154. seatCheck=0,
  155. temp,
  156. a,b,
  157. p;
  158. string FType;
  159. p=60-cust;
  160. cout<<"\nHow Many Ticket Do You Want?[ticket available:("<<p<<")]: ";
  161. cin>>totalTicBook;
  162. if (totalTicBook>p||totalTicBook<1)
  163. {
  164. do
  165. {
  166. cout<<"\nSorry!! Seat Available Not Enough Or Invalid Input...";
  167. cout<<"\nHow Many Ticket Do You Want?[ticket available:("<<p<<")]: ";
  168. cin>>totalTicBook;
  169. }while(totalTicBook>p||totalTicBook<1);
  170. }
  171. for (int i=1;i<=totalTicBook;i++)
  172. {
  173. system("cls");
  174. seatDisp(CinemaNo);
  175. cout<<"\nBooking["<<i<<"/"<<totalTicBook<<"]."<<"\nEnter The Seat Number(1 to 60): ";
  176. cin>>seatNo;
  177. if (seatNo<=10) // Ticket between 1 to 10
  178. {
  179. a=0;
  180. b=seatNo-1;
  181. if (CinemaSeatNo[a][b][CinemaNo]==1)
  182. {
  183. seatCheck=1;
  184. i--;
  185. cout<<"\nSorry...Ticket# "<<seatNo<<" booked!!\n";
  186. system("pause");
  187. }
  188. else
  189. {
  190. seatCheck=0;
  191. CinemaSeatNo[a][b][CinemaNo]=1;
  192. }
  193. }
  194. else
  195. if (seatNo>10&&seatNo<=20) // Ticket between 11 to 20
  196. {
  197. a=1;
  198. b=seatNo-11;
  199. if (CinemaSeatNo[a][b][CinemaNo]==1)
  200. {
  201. seatCheck=1;
  202. i--;
  203. cout<<"\nSorry...Ticket# "<<seatNo<<" booked!!\n";
  204. system("pause");
  205. }
  206. else
  207. {
  208. seatCheck=0;
  209. CinemaSeatNo[a][b][CinemaNo]=1;
  210. }
  211. }
  212. else
  213. if (seatNo>20&&seatNo<=30) // Ticket between 21 to 30
  214. {
  215. a=2;
  216. b=seatNo-21;
  217. if (CinemaSeatNo[a][b][CinemaNo]==1)
  218. {
  219. seatCheck=1;
  220. i--;
  221. cout<<"\nSorry...Ticket# "<<seatNo<<" booked!!\n";
  222. system("pause");
  223. }
  224. else
  225. {
  226. seatCheck=0;
  227. CinemaSeatNo[a][b][CinemaNo]=1;
  228. }
  229. }
  230. else
  231. if (seatNo>30&&seatNo<=40) // Ticket between 31 to 40
  232. {
  233. a=3;
  234. b=seatNo-31;
  235. if (CinemaSeatNo[a][b][CinemaNo]==1)
  236. {
  237. seatCheck=1;
  238. i--;
  239. cout<<"\nSorry...Ticket# "<<seatNo<<" booked!!\n";
  240. system("pause");
  241. }
  242. else
  243. {
  244. seatCheck=0;
  245. CinemaSeatNo[a][b][CinemaNo]=1;
  246. }
  247. }
  248. else
  249. if (seatNo>40&&seatNo<=50) // Ticket between 41 to 50
  250. {
  251. a=4;
  252. b=seatNo-41;
  253. if (CinemaSeatNo[a][b][CinemaNo]==1)
  254. {
  255. seatCheck=1;
  256. i--;
  257. cout<<"\nSorry...Ticket# "<<seatNo<<" booked!!\n";
  258. system("pause");
  259. }
  260. else
  261. {
  262. seatCheck=0;
  263. CinemaSeatNo[a][b][CinemaNo]=1;
  264. }
  265. }
  266. else
  267. if (seatNo>50&&seatNo<=60) // Ticket between 51 to 60
  268. {
  269. a=5;
  270. b=seatNo-51;
  271. if (CinemaSeatNo[a][b][CinemaNo]==1)
  272. {
  273. seatCheck=1;
  274. i--;
  275. cout<<"\nSorry...Ticket# "<<seatNo<<" booked!!\n";
  276. system("pause");
  277. }
  278. else
  279. {
  280. seatCheck=0;
  281. CinemaSeatNo[a][b][CinemaNo]=1;
  282. }
  283. }
  284. // ------------- saving cinemaseat --------------
  285. if (CinemaNo==0&&seatCheck==0)
  286. {
  287. ofstream fileout("Cinema1",ios::out|ios::binary);
  288. for(a=0;a<6;a++) // represents row
  289. {
  290. for(b=0;b<10;b++) // represents column
  291. {
  292. temp=CinemaSeatNo[a][b][CinemaNo];
  293. fileout<<temp<<" ";
  294. }
  295. }
  296. }
  297. else
  298. if (CinemaNo==1&&seatCheck==0)
  299. {
  300. ofstream fileout("Cinema2",ios::out|ios::binary);
  301. for(a=0;a<6;a++) // represents row
  302. {
  303. for(b=0;b<10;b++) // represents column
  304. {
  305. temp=CinemaSeatNo[a][b][CinemaNo];
  306. fileout<<temp<<" ";
  307. }
  308. }
  309. }
  310. else
  311. if (CinemaNo==2&&seatCheck==0)
  312. {
  313. ofstream fileout("Cinema",ios::out|ios::binary);
  314. for(a=0;a<6;a++) // represents row
  315. {
  316. for(b=0;b<10;b++) // represents column
  317. {
  318. temp=CinemaSeatNo[a][b][CinemaNo];
  319. fileout<<temp<<" ";
  320. }
  321. }
  322. }
  323.  
  324. }
  325. system("cls");
  326. seatDisp(CinemaNo);
  327. // -------------saving customer data--------------
  328. if (CinemaType==1&&CinemaNo==0)
  329. FType="AfterNoon - Pirates Of the Carribean 2";
  330. if (CinemaType==1&&CinemaNo==1)
  331. FType="AfterNoon - tipah tertipu";
  332. if (CinemaType==2&&CinemaNo==3)
  333. FType="Night - Pirates Of The Carribean";
  334. if (CinemaType==2&&CinemaNo==4)
  335. FType="Night - tipah tertipu";
  336. ofstream fout("customer",ios::out|ios::app|ios::binary);
  337. fout<<"Cinema : "<<FType<<endl<<"Total ticket(s) Booked: "<<totalTicBook<<endl;
  338. }
  339. //-------------------------------Find Record----------------------------------------
  340. int Cinema::findRecord(int CinemaNo)
  341. {
  342. int a,b,temp;
  343. cust=0;
  344. if (CinemaNo==0)
  345. {
  346. ifstream fin("Cinema1",ios::in|ios::binary);
  347. while (fin)
  348. {
  349. for(a=0;a<6;a++) // represents row
  350. {
  351. for(b=0;b<10;b++) // represents column
  352. {
  353. fin>>temp;
  354. if (!fin.fail())// avoid displaying the last char twice
  355. CinemaSeatNo[a][b][CinemaNo] = temp;
  356. if (temp==1)
  357. cust++;
  358. }
  359. }
  360. }
  361. }
  362. if (CinemaNo==1)
  363. {
  364. ifstream fin("Cinema2",ios::in|ios::binary);
  365. while (fin)
  366. {
  367. for(a=0;a<6;a++) // represents row
  368. {
  369. for(b=0;b<10;b++) // represents column
  370. {
  371. fin>>temp;
  372. if (!fin.fail())// avoid displaying the last char twice
  373. CinemaSeatNo[a][b][CinemaNo] = temp;
  374. if (temp==1)
  375. cust++;
  376. }
  377. }
  378. }
  379. }
  380. if (CinemaNo==2)
  381. {
  382. ifstream fin("Cinema3",ios::in|ios::binary);
  383. while (fin)
  384. {
  385. for(a=0;a<6;a++) // represents row
  386. {
  387. for(b=0;b<10;b++) // represents column
  388. {
  389. fin>>temp;
  390. if (!fin.fail())// avoid displaying the last char twice
  391. CinemaSeatNo[a][b][CinemaNo] = temp;
  392. if (temp==1)
  393. cust++;
  394. }
  395. }
  396. }
  397. }
  398. if (CinemaNo==3)
  399. {
  400. ifstream fin("flight4",ios::in|ios::binary);
  401. while (fin)
  402. {
  403. for(a=0;a<6;a++) // represents row
  404. {
  405. for(b=0;b<10;b++) // represents column
  406. {
  407. fin>>temp;
  408. if (!fin.fail())// avoid displaying the last char twice
  409. CinemaSeatNo[a][b][CinemaNo] = temp;
  410. if (temp==1)
  411. cust++;
  412. }
  413. }
  414. }
  415. }
  416. // ---- statement to solve the counting of customer ----
  417. if (cust>60)
  418. cust = cust-60;
  419. return (cust);
  420. }
  421. void customer::addCustomer()
  422. {
  423. string P;
  424. cin.ignore(size,'\n');
  425. cout<<"\nEnter Customer Name: ";
  426. cin.getline(name,size);
  427. cout<<"Enter Customer Address: ";
  428. cin.getline(address,size);
  429. cout<<"Enter Customer Contact Number(enter N/A if no contact no.): ";
  430. cin.getline(telNo,size);
  431. cout<<"Enter Type Of Payment"
  432. <<"\n[1] : Cash"
  433. <<"\n[2] : Credit Card\nChoice: ";
  434. cin>>payment;
  435. // ----------- saving customer details -----------
  436. if (payment==1)
  437. P="CASH";
  438. if (payment==2)
  439. P="CREDIT CARD";
  440. ofstream fout("customer",ios::out|ios::app|ios::binary);
  441. fout<<"Customer Name: "<<name<<endl<<"Customer Address: "<<address<<endl
  442. <<"Customer Contact Number: "<<telNo<<endl<<" Type Of Payment: "<<P<<endl<<endl;
  443. cout<<"\nBooking Process Is Done..\n";
  444. system("pause");
  445. system("cls");
  446. }
  447.  
  448. // ------------------Displaying available seat[0] or booked seat[1] -------------------
  449. int Cinema::seatDisp(int CinemaNo)
  450. {
  451. string title;
  452. if (CinemaNo==0)
  453. title="Pirates Of The Carribean";
  454. else
  455. if (CinemaNo==1)
  456. title="tipah tertipu";
  457. cust=Cinema::findRecord(CinemaNo);
  458. cout << "\n\n\tDisplaying Seat For " << title;
  459. cout << "\n\t--------------------------------------------------------------------\n";
  460. for(int a=0;a<6;a++)
  461. {
  462. cout<<"\t";
  463. for(int b=0;b<10;b++)
  464. {
  465. if(CinemaSeatNo[a][b][CinemaNo]==0)
  466. {
  467. if (a==0)
  468. cout<<setw(2)<<b+1<<"[0] ";
  469. else if (a==1)
  470. cout<<b+11<<"[0] ";
  471. else if (a==2)
  472. cout<<b+21<<"[0] ";
  473. else if (a==3)
  474. cout<<b+31<<"[0] ";
  475. else if (a==4)
  476. cout<<b+41<<"[0] ";
  477. else if (a==5)
  478. cout<<b+51<<"[0] ";
  479. }
  480. else
  481. if(CinemaSeatNo[a][b][CinemaNo]==1)
  482. {
  483. if (a==0)
  484. cout<<setw(2)<<b+1<<"[1] ";
  485. else if (a==1)
  486. cout<<b+11<<"[1] ";
  487. else if (a==2)
  488. cout<<b+21<<"[1] ";
  489. else if (a==3)
  490. cout<<b+31<<"[1] ";
  491. else if (a==4)
  492. cout<<b+41<<"[1] ";
  493. else if (a==5)
  494. cout<<b+51<<"[1] ";
  495. }
  496. }
  497. cout<<"\n\n";
  498. }
  499. cout<<"\t--------------------------------------------------------------------"
  500. <<"\n\tTotal Booked Seat: "<<cust;
  501. return (cust);
  502. }
  503. //------------------ Display/View Customer -----------------------
  504. void customer::dispCustomer()
  505. {
  506. char ch;
  507. system("cls");
  508. ifstream fin("customer",ios::in|ios::binary);
  509. cout<<"\n\t******************* Customer Details.. *******************\n\n\n";
  510. if(!fin)
  511. {
  512. cerr<<"\nError opening the file..!!\n";
  513. }
  514. while(fin)
  515. {
  516. fin.get(ch);
  517. if (!fin.fail()) // avoid displaying the last char twice
  518. cout<<ch;
  519. }
  520. system("pause");
  521. system("cls");
  522. }
  523.  
  524. int main()
  525. {
  526. int choice,seatchoice;
  527. int menu=0;
  528. int CinemaMenu=0;
  529. int cinMenu = 0;
  530. Cinema F;
  531. customer C;
  532. system("cls");
  533. cout << "\t*****************************************************\n";
  534. cout << "\t* *\n";
  535. cout << "\t* Welcome To *\n";
  536. cout << "\t* __3N Air Asia__ *\n";
  537. cout << "\t* *\n";
  538. cout << "\t*****************************************************\n";
  539. do
  540. {
  541. cout << "\n\n\t^^^^^^^^^^^^^^^^^^^^^ MAIN MENU ^^^^^^^^^^^^^^^^^^^^^\n\n";
  542. cout << "\t1. View Available Cinema\n";
  543. cout << "\t2. Check Available Seats\n";
  544. cout << "\t3. Book Ticket(s)\n";
  545. cout << "\t4. View Customer Bookings\n\n";
  546. cout << "\t0. Quit From System\n";
  547. cout << "\n\n\t^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^";
  548. cout << "\n\n\tEnter your option : ";
  549. cin >> choice;
  550.  
  551. switch(choice)
  552. {
  553. case 1:
  554. viewTime();
  555. break;
  556. case 2:
  557. system("cls");
  558. do
  559. {
  560. cout<< "\n\t^^^^^^^^^^^^^^^^^^^^^ AVAILABLE SEATS ^^^^^^^^^^^^^^^^^^^^^^^^^\n\n"
  561. << "\t1. Available Seat For Pirates Of The Carribean\n"
  562. << "\t2. Available Seat For tipah tertipu\n"
  563. << "\t0. To Quit From Available Seats Menu\n"
  564. << "\t^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n"
  565. << "\tEnter Your Option : ";
  566. cin>>seatchoice;
  567. switch(seatchoice)
  568. {
  569. case 1:
  570. F.seatDisp(seatchoice-1);
  571. break;
  572. case 2:
  573. F.seatDisp(seatchoice-1);
  574. break;
  575. case 3:
  576. F.seatDisp(seatchoice-1);
  577. break;
  578. case 4:
  579. F.seatDisp(seatchoice-1);
  580. break;
  581. case 0:
  582. cinMenu=1;
  583. system("cls");
  584. break;
  585. default:
  586. cerr << "Invalid choice" << endl << endl;
  587. system ("pause");
  588. }
  589. }while(cinMenu !=1);
  590. break;
  591.  
  592. case 3:
  593. if (C.selectCinema()==2)
  594. C.addCustomer();
  595. break;
  596. case 4:
  597. C.dispCustomer();
  598. break;
  599. case 0:
  600. menu = 1;
  601. system ("cls");
  602. cout << "\n\t__________________________________________________________________\n\n\n";
  603. cout << "\t Thank you for using 3N Air Asia Flight System :) ... \n\n";
  604. cout << "\n\t__________________________________________________________________\n\n";
  605. break;
  606. default:
  607. cerr << "Invalid choice" << endl << endl;
  608. system ("pause");
  609. system("cls");
  610. }
  611. }while (menu !=1);
  612.  
  613.  
  614. system ("pause");
  615. return 0;
  616. }
-------------------------------------------------------------------------------

i really hope that anyone of u can help me to make this program more accurately.thank you very much..
Last edited by cscgal; Jun 26th, 2006 at 6:53 am.
Reply With Quote Quick reply to this message  
Join Date: Aug 2005
Posts: 5,266
Reputation: iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold 
Solved Threads: 377
Featured Poster
iamthwee's Avatar
iamthwee iamthwee is offline Offline
Posting Expert

Re: can anyone of u help me for this program

 
0
  #2
Jun 26th, 2006
Do you really need to be using a 3d array?

Where is your delete part?

Which part specifically are you having difficulty with?

Use code tags.
*Voted best profile in the world*
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the C++ Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC