Автор работы: Пользователь скрыл имя, 28 Марта 2013 в 18:18, курсовая работа
Работа над данным курсовым проектом направлена на разработку заданной вариантом программы, используя при этом схему проектирования MVC, а также знания, полученные в процессе изучения курса по данной дисциплине.
Разрабатываемый в данной программе справочник филателиста предназначен для коллекционирования марок, имея в своем распоряжении базу данных всех известных вам марок, а также базу данных марок своей собственной коллекции. Идет расчет на то, что в любой момент пользователь может править списки марок любой из этих баз данных. Для облегченного доступа к определенной марке будет разработана поисковая система.
Введение………………………………………………………………………...…3
1 Постановка задачи ................................................................ ......... 4
1,1 Исходные данные ........................................................................ 4
1,2 Описание предметной области ........................................................ 4
1,3 Создание объектной модели ........................................................... 5
1,4 Терминологический словарь ............... .......................................... 6
2 Описание программы ........................................................... ........... 7
2,1 Описание иерархии классов и объектов ............................................ 7
3 Руководство пользователя .................. ............................................. 9
Заключение……..……………..….…………...……..…………………….……..14
Перечень ссылок ....................................... ...................................... 15
ПРИЛОЖЕНИЕ ............................................. ................................. 16
}
}
void Controller::ShowMarks()
{
this->view->PrintMarks(this->
string input="";
VvodFail();
while(!(strcmp(input.c_str(),"
{
view->WriteLine("Print 0 for exit, or 9 for back to the previous menu");
input = view->ReadLine();
}
if(strcmp(input.c_str(),"0")==
{
exit(0);
}
else
if(strcmp(input.c_str(),"9")==
{
StartSystem();
}
}
void Controller::ShowFilantelists()
{
this->view->PrintFilatelists(t
string input="";
VvodFailf();
while(!(strcmp(input.c_str(),"
{
view->WriteLine("Print 0 for exit, or 9 for back to the previous menu");
input = view->ReadLine();
}
if(strcmp(input.c_str(),"0")==
{
exit(0);
}
else
if(strcmp(input.c_str(),"9")==
{
StartSystem();
}
}
void Controller::
{
view->WriteLine();
view->WriteLine("Welcome to MyMarks admin menu:");
string input="a";
while(!(strcmp(input.c_str(),"
{
view->WriteLine("Enter password, or print 0 for exit, or 9 for back to the previous menu");
input = view->ReadLine();
}
if(strcmp(input.c_str(),"0")==
{
exit(0);
}
if(strcmp(input.c_str(),"9")==
{
this->StartSystem();
}
view->WriteLine();
view->WriteLine("Please choose option!");
view->WriteLine("1 - Add Mark in my collection");
view->WriteLine("2 - Remove mark in my collection");
input="a";
while(!(strcmp(input.c_str(),"
{
view->WriteLine("Choose option or print 0 for exit, or 9 for back to the previous menu");
input = view->ReadLine();
}
if(strcmp(input.c_str(),"1")==
{
AddMyMark();
}
else
if(strcmp(input.c_str(),"2")==
{
RemoveMyMark();
}
else
if(strcmp(input.c_str(),"9")==
{
StartSystem();
}
else
if(strcmp(input.c_str(),"0")==
{
exit(0);
}
}
void Controller::AddMyMark()
{
view->WriteLine("Please enter information about mark:");
Mark newMark = EnterMark();
this->model.GetMyMarksList()->
this->model.GetAllMarksList()-
VivodFail(newMark);
string input="";
while(!(strcmp(input.c_str(),"
{
view->WriteLine("Enter new mark(y)?n - back");
input = view->ReadLine();
}
if(strcmp(input.c_str(),"y")==
{
AddMark();
}
else
if(strcmp(input.c_str(),"n")==
{
ShowAdminMyMarksMenu();
}
}
void Controller::RemoveMyMark()
{
this->view->PrintMarks(this->
view->WriteLine("Please enter id of mark!");
string input = view->ReadLine();
int id = atoi(input.c_str());
Mark deleteMark;
int i = 1;
for(list<Mark>::iterator it = this->model.GetMyMarksList()->
{
if(id == i)
{
deleteMark = *it;
}
i++;
}
this->model.GetMyMarksList()->
input="";
while(!(strcmp(input.c_str(),"
{
view->WriteLine("Remove other mark(y)?n - back");
input = view->ReadLine();
}
if(strcmp(input.c_str(),"y")==
{
RemoveMark();
}
else
if(strcmp(input.c_str(),"n")==
{
ShowAdminMyMarksMenu();
}
}
void Controller::
{
view->WriteLine();
view->WriteLine("Welcome to AllMarks admin menu:");
string input="a";
while(!(strcmp(input.c_str(),"
{
view->WriteLine("Enter password, or print 0 for exit, or 9 for back to the previous menu");
input = view->ReadLine();
}
if(strcmp(input.c_str(),"0")==
{
exit(0);
}
if(strcmp(input.c_str(),"9")==
{
this->StartSystem();
}
view->WriteLine();
view->WriteLine("Please choose option!");
view->WriteLine("1 - Add Mark");
view->WriteLine("2 - Remove mark");
input="a";
while(!(strcmp(input.c_str(),"
{
view->WriteLine("Choose option or print 0 for exit, or 9 for back to the previous menu");
input = view->ReadLine();
}
if(strcmp(input.c_str(),"1")==
{
AddMark();
}
else
if(strcmp(input.c_str(),"2")==
{
RemoveMark();
}
else
if(strcmp(input.c_str(),"9")==
{
StartSystem();
}
else
if(strcmp(input.c_str(),"0")==
{
exit(0);
}
}
void Controller::AddMark()
{
view->WriteLine("Please enter information about mark:");
Mark newMark = EnterMark();
this->model.GetAllMarksList()-
VivodFail(newMark);
string input="";
while(!(strcmp(input.c_str(),"
{
view->WriteLine("Enter new mark(y)?n - back");
input = view->ReadLine();
}
if(strcmp(input.c_str(),"y")==
{
AddMark();
}
else
if(strcmp(input.c_str(),"n")==
{
ShowAdminMarksMenu();
}
}
void Controller::RemoveMark()
{
this->view->PrintMarks(this->
view->WriteLine("Please enter id of mark!");
string input = view->ReadLine();
int id = atoi(input.c_str());
Mark deleteMark;
int i = 1;
for(list<Mark>::iterator it = this->model.GetAllMarksList()-
{
if(id == i)
{
deleteMark = *it;
}
i++;
}
this->model.GetAllMarksList()-
input="";
while(!(strcmp(input.c_str(),"
{
view->WriteLine("Remove other mark(y)?n - back");
input = view->ReadLine();
}
if(strcmp(input.c_str(),"y")==
{
RemoveMark();
}
else
if(strcmp(input.c_str(),"n")==
{
ShowAdminMarksMenu();
}
}
void Controller::ShowMyMarks()
{
this->view->PrintMyMarks(this-
string input="";
VvodFail();
while(!(strcmp(input.c_str(),"
{
view->WriteLine("Print 0 for exit, or 9 for back to the previous menu");
input = view->ReadLine();
}
if(strcmp(input.c_str(),"0")==
{
exit(0);
}
else
if(strcmp(input.c_str(),"9")==
{
StartSystem();
}
}
Mark Controller::EnterMark()
{
Mark mark;
this->view->WriteLine();
this->view->WriteLine("Enter country:");
mark.SetCountry(view->
this->view->WriteLine("Enter price:");
mark.SetPrice(atof(view->
this->view->WriteLine("Enter year:");
mark.SetYear(atoi(view->
this->view->WriteLine("Enter count:");
mark.SetCount(atoi(view->
this->view->WriteLine("Enter feature:");
mark.SetFeature(view->
this->view->WriteLine();
return mark;
}
void Controller::
{
view->WriteLine();
view->WriteLine("Welcome to Filatelists admin menu:");
string input="a";
while(!(strcmp(input.c_str(),"
{
view->WriteLine("Enter password, or print 0 for exit, or 9 for back to the previous menu");
input = view->ReadLine();
}
if(strcmp(input.c_str(),"0")==
{
exit(0);
}
if(strcmp(input.c_str(),"9")==
{
this->StartSystem();
}
view->WriteLine();
view->WriteLine("Please choose option!");
view->WriteLine("1 - Add filatelist in the list");
view->WriteLine("2 - Remove filatelist out the list");
input="a";
while(!(strcmp(input.c_str(),"
{
view->WriteLine("Choose option or print 0 for exit, or 9 for back to the previous menu");
input = view->ReadLine();
}
if(strcmp(input.c_str(),"1")==
{
AddFilatelist();
}
else
if(strcmp(input.c_str(),"2")==
{
RemoveFilatelist();
}
else
if(strcmp(input.c_str(),"9")==
{
StartSystem();
}
else
if(strcmp(input.c_str(),"0")==
{
exit(0);
}
}
Filatelist Controller::EnterFilatelist()
{
Filatelist filatelist;
this->view->WriteLine();
this->view->WriteLine("Enter country:");
filatelist.SetCountry(view->
this->view->WriteLine("Enter name:");
filatelist.SetName(view->
this->view->WriteLine("Enter contacts:");
filatelist.SetContact(view->
this->view->WriteLine("Enter the precence artefacts:");
filatelist.SetArtefact(atoi(
this->view->WriteLine();
return filatelist;
}
void Controller::AddFilatelist()
{
view->WriteLine("Please enter information about filatelist:");
Filatelist newFilatelist = EnterFilatelist();
this->model.
string input="";
VivodFailf(newFilatelist);
while(!(strcmp(input.c_str(),"
{
view->WriteLine("Enter new filatelist(y)?n - back");
input = view->ReadLine();
}
if(strcmp(input.c_str(),"y")==
{
AddFilatelist();
}
else
if(strcmp(input.c_str(),"n")==
{
ShowAdminFilatelistsMenu();
}
}
void Controller::RemoveFilatelist()
{
this->view->PrintFilatelists(t
view->WriteLine("Please enter id of filatelist");
string input = view->ReadLine();
int id = atoi(input.c_str());
Filatelist deleteFilatelist;
int i = 1;
for(list<Filatelist>::iterator it = this->model.
{
if(id == i)
{
deleteFilatelist = *it;
}
i++;
}
this->model.
input="";
while(!(strcmp(input.c_str(),"
{
view->WriteLine("Remove other filatelists(y)?n - back");
input = view->ReadLine();
}
if(strcmp(input.c_str(),"y")==
{
RemoveFilatelist();
}
else
if(strcmp(input.c_str(),"n")==
{
ShowAdminFilatelistsMenu();
}
}
void Controller::VivodFail(Mark newMark)
{
ofstream book_file("BOOKINFO.DAT",ios::
book_file <<"Country " <<newMark.country <<endl;
book_file <<"Price " <<newMark.price<< endl;
book_file <<"Year " <<newMark.year << endl;
book_file <<"Count "<< newMark.count<< endl;
book_file <<"Features "<< newMark.features << endl;
book_file <<" "<<endl;
}
void Controller::VvodFail()
{
char line[10000];
ifstream input_file("BOOKINFO.DAT");
while (! input_file.eof())
{
input_file.getline(line, sizeof(line));
cout << line << endl;
}
}
void Controller::VivodFailf(
{
ofstream book_file("BOOKINFOF.DAT",ios:
book_file <<"Country " <<newFilatelist.country <<endl;
book_file <<"Name " <<newFilatelist.name<< endl;
book_file <<"Contacts " <<newFilatelist.contacts << endl;
book_file <<"Artefacts "<< newFilatelist.artefacts<< endl;
book_file <<" "<<endl;
}
void Controller::VvodFailf()
{
char line[1000];
ifstream input_file("BOOKINFOF.DAT");
while (! input_file.eof())
{
input_file.getline(line, sizeof(line));
cout << line << endl;
}
}
Controller::~Controller(void)
{
}