Untitled
unknown
plain_text
4 years ago
2.8 kB
13
Indexable
//John Matthew G. Malabag
//Jeremiah Valenciado
//Apple Mae Bugtay
//GROUP NAME: Hackerman
#include <iostream>
#include "Data.h"
using namespace std;
int menu();
int main()
{
MovieList list;
Movie num;
int choice;
do
{
choice = menu();
system("clear");
if (choice == 1)
{
cout << "Enter Code : ";
cin >> num.code;
cout << "Input Movie Title: ";
cin>>num.name;
cout << "Input Released Year: ";
cin >> num.year;
if((num.year >=1900)&&(num.year<=2030))
{
cout<<"Input Movie Genre: ";
cin >> num.genre;
list.insertNode(num); //INSERT
}else{
cout<<"Invalid Year!"<<endl;
cout<<"Please enter again: ";
}
}
else if (choice == 2)
{
cout << " << Rent a Movie >> " << endl << endl;
cout << "Enter Code : ";
cin >> num.code;
list.deleteNode(num); //RENT TO REMOVE FROM THE LIST
}
else if (choice == 3)
{
cout << " << Return a Movie >> " << endl << endl;
cout << "Enter Movie Code : ";
cin >> num.code;
cout << "Enter Movie Title: ";
cin >> num.name;
cout << "Enter Year Released: ";
cin >> num.year;
if((num.year >=1900)&&(num.year<=2030))
{
cout<<"Enter Genre: ";
cin >> num.genre;
list.appendNode(num); //RETURN CHOICE TO ADD TO LIST
}else{
cout<<"Invalid Year!"<<endl;
cout<<"Please enter again: ";
}
}
else if (choice == 4)
{
cout << " << Show Movie Details >> " << endl << endl;
list.showDetails(num);
system("sleep 1");
}
else if (choice == 5)
{
cout << "<< Show Available Movies >>" << endl<<endl;
list.displayList();
system("sleep 3s");
}
else if (choice == 6)
{
cout <<"Thank you come again!" <<endl;
list.~MovieList();
exit(0);
}
else
{
cout << "Invalid Input!" << endl << endl;
system("sleep 1");
break;
}
cout << endl;
system("sleep 1");
} while (choice >= 1 && choice <= 6);
}
int menu()
{
int choice;
system("clear");
cout << " -***- Movie Rental Service -***- " << endl << endl;
cout << "[1] Insert a Movie" << endl;
cout << "[2] Rent a Movie" << endl; //Rent to remove from the Movie List
cout << "[3] Return a Movie" << endl; //Return to add to the Movie list
cout << "[4] Show Movie Details" << endl;
cout << "[5] Print Movie List" << endl << endl;
cout << "[6] Quit Program" << endl << endl;
cout << "Enter Choice: ";
cin >> choice;
return(choice);
}Editor is loading...