Sie sind auf Seite 1von 83

PROJECT REPORT ON HOTEL MANAGEMENT Submitted in the partial fulfillment of requirements of the prescribed course for the award

of BACHELOR OF TECHNOLOGY IN COMPUTER SCIENCE & ENGINEERING OF MAHRISHI MARKANDESHWER UNIVERSITY, MULLANA

Submitted by: RESHU BEDI 11092808 Department of COMPUTER SCIENCE & ENGINEERING M.M ENGINEERING COLLEGE ,MULLANA(AMBALA)

TABLE OF CONTENTS

Abstract An Introduction to the organization Complete structure of the program Type of output/Report generation Introduction of c++ Hardware & Software requirements Source code Screenshots Future enhancement Conclusion Bibliography

ACKNOWLEDGEMENT

First of all I would like to thank the supreme power, the almighty god who has always guided us to work on the right path of our life. Without his grace this project could not become a reality. Secondly, my parents who have always inspire and encouraged me through my life. I feel obliged in taking the opportunity to thank the ITC people and my worthy thank to my training officer ,Mr.Sanjeev Mittal who supported me theoretically and practically. Project is like a bridge between theoretical and practical working. With this will I joined this particular project. Its a matter of great pleasure for me to submit a project report on HOTEL MANAGEMENT SYSTEM.

ABSTRACT
1. To increase the efficiency. 2. To increase the degree of accuracy. 3. To make the day to day work easier. 4. To minimize the time in getting the required information. 5. To reduce redundancy. 6. To provide the management with the reports at the right times . In the manual system there are many drawbacks and the disadvantages. in spite of adequate care taken to make the functioning of the system easy, most of the time there are problems when a query is to be made or a report is to be generated. This project is intended to help the people associated with the managing of the hotel, to make their task easier with better accuracy & fast information retrieval.this project will contain all the activities associated with the hotel such as keeping track of the facilities accept,facilities reject , no. of facilities in the stock etc. the proposed system will follow the same procedure as the manual one i.e. the system does not require any major changes in the present functioning except from converting the manual system into computerized system which will reduce the paper work to the large extent. This will encourage the people to follow the hotel management system and not hesitant in adopting the new technology. this is because the people are usual.

INTRODUCTION TO THE ORGANIZATION

ITC LIMITED
ITC is one of India's foremost private sector companies with a market capitalisation of over US $ 33 billion and a turnover of US $ 7 billion. ITC is rated among the World's Best Big Companies, Asia's 'Fab 50' and the World's Most Reputable Companies by Forbes magazine, among India's Most Respected Companies by Business World and among India's Most Valuable Companies by Business Today. ITC ranks among India's `10 Most Valuable (Company) Brands', in a study conducted by Brand Finance and published by the Economic Times. ITC also ranks among Asia's 50 best performing companies compiled by Business Week. ITC has a diversified presence in Cigarettes, Hotels, Paperboards & Specialty Papers, Packaging, Agri-Business, Packaged Foods & Confectionery, Information Technology, Branded Apparel, Personal Care, Stationery, Safety Matches and other FMCG products. While ITC is an outstanding market leader in its traditional businesses of Cigarettes, Hotels, Paperboards, Packaging and Agri-Exports, it is rapidly gaining market share even in its nascent businesses of Packaged Foods & Confectionery, Branded Apparel, Personal Care and Stationery. As one of India's most valuable and respected corporations, ITC is widely perceived to be dedicatedly nation-oriented. Chairman Y C Deveshwar calls this source of inspiration "a commitment beyond the market". In his own words: "ITC believes that its aspiration to create enduring value for the nation provides the motive force to sustain growing shareholder value. ITC practices this philosophy by not only driving each of its businesses towards international competitiveness but by also consciously contributing to enhancing the competitiveness of the larger value chain of which it is a part." ITC's diversified status originates from its corporate strategy aimed at creating multiple drivers of growth anchored on its time-tested core competencies: unmatched distribution reach, superior brand-building capabilities, effective supply chain management and acknowledged service skills in hoteliering. Over time, the strategic forays into new businesses are expected to garner a significant share of these emerging high-growth markets in India.

ITC's Agri-Business is one of India's largest exporters of agricultural products. ITC is one of the country's biggest foreign exchange earners (US $ 3.2 billion in the last decade). The Company's 'e-Choupal' initiative is enabling Indian agriculture significantly enhance its competitiveness by empowering Indian farmers through the power of the Internet. This transformational strategy, which has already become the subject matter of a case study at Harvard Business School, is expected to progressively create for ITC a huge rural distribution infrastructure, significantly enhancing the Company's marketing reach. ITC's wholly owned Information Technology subsidiary, ITC Infotech India Ltd, provides IT services and solutions to leading global customers. ITC Infotech has carved a niche for itself by addressing customer challenges through innovative IT solutions. ITC's production facilities and hotels have won numerous national and international awards for quality, productivity, safety and environment management systems. ITC was the first company in India to voluntarily seek a corporate governance rating. ITC employs over 24,000 people at more than 60 locations across India. The Company continuously endeavors to enhance its wealth generating capabilities in a globalising environment to consistently reward more than 4,18,000 shareholders, fulfill the aspirations of its stakeholders and meet societal expectations. This over-arching vision of the company is expressively captured in its corporate positioning statement: "Enduring Value. For the Nation. For the Shareholder."

COMPLETE STRUCTURE OF THE PROGRAM

MODULES:(A) Main Interface:- This module is used to show the menu to the user and allow him to select an option from the list. (B) Book Menu Interface- This is used to allow the user to perform operations relating to books such as addition of books, deletion of books etc. This module further contains add, delete & modify modules. (C) Records-This module is used to make an entry of each & every book issued and returned . This module is divided into return & issue modules. (D) Search-This module is used to allow the user to find the required book in the Library. (E) Member Module- This module is used to enter , delete or modify information relating to the members. This module is further divided into add, modify & delete modules.

TYPES OF OUTPUT/REPORT GENERATION


This Software like any other useful software generates various Reports & Outputs such as:-

(1) Details of Hotel with a particular Unique-Id (2) Detail of member with a unique Registration No. (3) Search process has also been provided which gives the output according to Name of the HOTEL Validations has also been provided so that no field is left Blank.

INTRODUCTION TO C++
Object oriented Programming emphasized on the data rather than the algorithm. In the OOP, data is compartmentalized or encapsulated with the associated functions and this compartment or capsule called an object. In the OOP approach, the problem is divided into functions. OOP language allows localization of data and code and restricts other objects from referring to its local region. OOP is centered around the concepts of objects, encapsulations, abstract data types, inheritance, polymorphism, message based communication, etc. An OOP language views the data and its associated set of functions as an object and treats this combination as a single entity. Thus an object is visualized as a combination of data and functions, which manipulate them.

During the execution of a program, the objects interact with each other by sending messages and receiving responses. An object communication with other objects need not be aware of the internal working of the objects with which it interacts. An object can be manipulated through an interface that responds to a few messages. The objects internal structure is totally hidden from the user and this property is called data/information hiding or data encapsulation.

The external interfaces are implemented by providing a set of methods, each of which accepts and responds to a particular kind of message. The methods defined in an objects class are the same for all objects belonging to that class but, the data is unique for each object.

Many object oriented analysis and object oriented design methodologies have emerged recently although the concepts underlying object orientation as a programming discipline has been developed long time ago. Object oriented methodologies represent a radical change over conventional methodologies such as structured analysis.

Various object-oriented methodologies can be best investigated by dividing them into two camps revolutionaries and synthesizes. Revolutionaries believe that object orientation is a radical change that renders conventional methodologies and ways of thinking obsolete. Synthesizes view object orientation as simply an accumulation of sound software engineering principles, which adopters can graft onto their existing methodologies with relative ease.

The revolutionaries state the following:

There should be no doubt that OOD is fundamentally different from traditional structured design approaches, it requires a different way of thinking about decomposition, and it produces software architectures that are largely outside the realm of the structured design culture.

There is no doubt one could arrive at the same results using different methods; same time but it is revealed that from experience that the thinking process, the discovery process, and the communication between the user and analyst are fundamentally different with OOA than with structured analysis.

On the other side the synthesiss states the following:

Object oriented structured design methodology is essentially an elaboration of structured design. They state that the foundation of OOSD is structured design, and that structured design includes most if the necessary concepts and notations for OOSD.

There is no doubt that object orientation has been touted as a revolutionary approach is a complete break with the past. OOA is a refinement of some the best software engineering ideas of the past.

The design of an object appears over a sequence of stages. Its helpful to have this perspective because you stop expecting perfection right away; instead you realize that the understanding of what an object does and what it should look like happens over time. This view also applies to the design of various types of programs; the pattern for a particular type of program emerges through struggling again and again with that problem. Objects too have their patterns that emerge through understanding, use and reuse.

1. OBJECT DISCOVERY: This stage occurs during the initial analysis of a program. Looking for external factors and boundaries, duplication of elements in the system, and the smallest conceptual units may discover objects. Some objects are obvious if you already have a set of

class libraries. Commonality between classes suggesting base classes and inheritance may appear right away, or later in the design process.

2. OBJECT ASSEMBLY: As we are building an object we will discover the need for new members that didnt appear during discovery. The internal needs of the object may require other classes to support it.

3. SYSTEM CONSTRUCTION: Once again, more requirements for an object may appear at this later stage. As you learn you evolve our objects. The need for communication and interconnection with other objects in the system may change the needs of our classes or require new classes. For example we may discover the need for facilitator or helper classes, such as a linked list, that contain little or no state information and simply help other classes function.

4. SYSTEM EXTENSION: As we add new features to a system we may discover that your previous design doesnt support easy system extension. With this new information, you can restructure parts of the system, possibly adding new classes or class hierarchies.

5. OBJECT REUSE: This is the real stress test for a class. If someone tries to reuse it in an entirely new situation, they will probably discover some shortcomings. As you change a class to adapt to more new programs, the general principles of the class will become clearer, until you have a truly reusable type. However dont expect most object from a system design to be reusable-it is perfectly acceptable for the bulk of your object to be system-specific.

Reusable types tend to be less common, and they must solve more general problems in order to be reusable.

ADVANTAGES OF OBJECT ORIENTED PROGRAMMING.

Simplicity: software objects model real world objects, so the complexity is reduced and the program structure is very clear.

Modularity: each object forms a separate entity whose internal workings are decoupled from other parts of the system.

Modifiability: it is easy to make minor changes in the data representation or the procedures in an OO program. Changes inside a class do not affect any other part of a program, since the only public interface that the external world has to a class is through the use of methods.

Extensibility: adding new features or responding to changing operating environments can be solved by introducing a few new objects and modifying some existing ones.

Maintainability: objects can be maintained separately, making locating and fixing problems easier.

Re-usability: objects can be reused in different programs.

FEATURES OF OBJECT ORIENTED PROGRAMMING


It is necessary to understand some of the concepts used extensively in object - oriented programming. These include:

Objects Classes Data Abstraction and encapsulation Inheritance Polymorphism Dynamic binding Message Passing

We shall discuss these concepts in some detail in this Section.

Objects

Objects are the basic run time entitles in an object oriented system. They may represent a person, a place, a bank account, a table of data or any item that the program has to handle. They may also represent user defined data such as vectors, time and lists. Programming

problem is analyzed in terms of objects and the nature of communication between them. Program objects should be chosen such that they match closely with the real world objects.

Objects take up space in the memory and have an associated address like a record in Pascal, or a structure in C.

When a program is executed, the objects interact by sending message to one another. For example, if customer and account are two objects in a program, then the customer object may send a message to the account object requesting for the bank balance. Each object contains data, and code to manipulate the data. Objects can interact without having to know details of each others data or code. It is sufficient to know the type of message accepted, and the type of response returned by the objects. Although different authors represent them differently, shows tow notations that are popularly used in object oriented analysis and design.

Classes

We just mentioned that objects contain data, and code to manipulate that data. The entire set of data and code of an object can be made a user defined data type with the help of a class. In fact, objects are variables of the type class. Once a class has been defined, we can create any number of objects belonging to that class. Each object is associated with the data of type class with which they are created. A class is thus a collection of objects of similar type. For example, mango, apple and orange are members of the class fruit. Classes are user defined data types and behave like the built in types of a programming language. The syntax used to create an

object is no different than the syntax used to cerate an integer object in C. If fruit has been defined as a class, then the statement.

Fruit mango;
Will create an object mango belonging to the class fruit

Data Abstraction and Encapsulation

The wrapping up of data and functions into a single unit (called class) is known as encapsulation. Data encapsulation is the most striking feature of a class. The data is not accessible to the outside world, and only those functions, which are wrapped in the class, can access it. These functions provide the interface between the objects data and the program. This insulation of the data from direct access by the program is called data hiding or information hiding.

Abstraction refers to the act of representing essential features without including the background details or explanations. Classes use the concept of abstraction and are defined as a list of abstract attributes such as size, weight and cost, and functions to operate on these attributes. They encapsulate all the essential properties of the objects that are to be created. The

attributes are sometimes called data members because they hold information. The functions that operate on these data are sometimes called methods or member functions. Since the classes use the concept of data abstraction, they are known as Abstract Data Types (ADT).

Inheritance
Inheritance is the process by which objects of one class acquire the prosperities of objects of another class. It supports the concept of hierarchical classification. For example, the bird robin is a part of the class flying bird, which is again a part of the class bird. The principle behind this sort of division is that each derived class shares common characteristics with the class from which it is derived as illustrated. In OOP, the concept of inheritance provides the idea of reusability. This means that we can add additional features to an existing class without modifying it. This is possible by deriving a new class from the existing one. The new class will have the combined features of both the classes. The real appeal and power of the inheritance mechanism is that it allows the programmer to reuse a class that is almost, but not exactly, what he wants, and to tailors the class in such a way that it does not introduce any undesirable side effects into the rest of the classes. Note that each sub class defines only those features that are unique to it. Without the use of classification, each class would have to explicitly include all of its features.

Polymorphism and Overloading


Polymorphism is another important OOP concept. Polymorphism, a Greek term, means the ability to take more than one form. An operation may exhibit different behavior in different

instances. The behavior depends upon the types of data used in the operation. For example, consider the operation of addition. For two numbers, the operation will generate a sum. If the operands are strings, then the operation would produce a third string by concatenation. The process of a making an operator to exhibit different behaviors in different instances is known as operator overloading. Illustrates that a single function name can be used to handle different number and different types of arguments. This is something similar to a particular word having several different meanings depending on the context. Using a single function name to perform different types of tasks is known as function overloading. Polymorphism plays an important role in allowing objects having different internal structures to share the same external interface. This means that a general class of operations may be accessed in the dame manner even though specific actions associated with each operation may differ. Polymorphism is extensively used in implementing inheritance.

Dynamic Binding
Binding refers to the linking of a procedure call to the code to be executed in response to the call. Dynamic binding (also known as late binding) means that the code associated with a given procedure call is not known until the time of the call at run time. It is associated with a polymorphic reference depends on the dynamic type of the reference. Inheritance every object will have this procedure. Its algorithm is, however, unique to each object and so the draw procedure will be redefined in each class that defines the object. At run time, the code matching the object under current reference will be called.

Message Passing
An object oriented program consists of a set of objects that communicate with each other. The process of programming in an object oriented language, therefore, involves the following basic steps. 1. Creating classes that define objects and their behavior. 2. Creating objects from class definitions, and 3. Establishing communication among objects. Objects communicate with one another by sending and receiving information much the same way as people pass messages to one another. The concept of message passing makes it easier to talk about building systems that directly model or simulate their real world counterparts. A message for an object is a request for execution of a procedure, and therefore will invoke a function (procedure) in the receiving object that generates the desired result. Message Passing involves specifying the name of the object, the name of the function (message) and the information to be sent. Objects have a life cycle. They can be created and destroyed. Communication with an object is feasible as long as it is alive.

IDENTIFICATION OF NEEDS
Object-oriented programming promises to solve many key problems of software engineering like reuse, extensibility, and maintainability. Adding to the initial costs of software purchase are often considerable software maintenance costs. Object-Oriented Software

Construction gives a breakdown of these costs, based on a survey of 487 installations developing various application software. The high percentage of changing user requirements is not surprising in view of the rapid technology changes and increasing user expectations. The high costs involved reflect on conventional software and its inability to cope with change. Software quality aspects can be grouped into internal and external quality factors. The internal quality factors apply to the "inner workings" of software modules such as modularity or readability, and are generally of not much concern to the end user of the software, unless the user is concerned with self-developed extensions. Of more importance for the end user are external factors such as: Correctness: - The ability of software products to exactly perform their tasks, as defined by the requirements and specifications. Robustness: - The ability of software systems to function even in abnormal conditions. Extendibility: - The ease with which software products may be adapted to changes of specifications. Reusability: - The ability of software products to be reused, in whole or in part, for new applications. Compatibility: - The ease with which software products may be combined with others.

SYSTEM STUDY HARDWARE & SOFTWARE REQUIREMENTS

HARDWARE REQUIREMENTS: PARTICULARS COMPUTER SYSTEM MONITOR PRINTER OPERATING SYSTEM DESCRIPTION CELERON 700MHz Equivalent to at least 64 MB MONOCROME/COLOURED LASER 6L WINDOWS-95/98/ME

SOFTWARE REQUIREMENTS: The operating system is needed to seen the system should be windows 95/me. The project assigned is to create a Library Management System for this project we make use of this language: 1. C++

///**************************************************************************** ****************************************************

/// project hotel managment system /// password:hms ///**************************************************************************** *** ///**************************************************************************** ***** /// include header files ///**************************************************************************** **** #include<iostream.h> #include<conio.h> #include<dos.h> #include<string.h> #include<fstream.h> #include<process.h> #include<stdlib.h> #include<stdio.h> #include<ctype.h> ///**************************************************************************** ********** /// class name:menu /// details :it controls over all the functions ///**************************************************************************** **** class menu { public: void main_menu(void); void enter_password(void); void line_hor(int,int,int,char); void line_ver(int,int,int,char); private: void edit_menu(void); void report_menu(void); void room_edit_menu(void); void customer_edit_menu(void); void box_password(void); void box_menu(void); };

///**************************************************************************** *************** /// class name:room /// details :it controls over all the functions /// related to room ///**************************************************************************** *********** class room { public: void add(void); void modify(void); void deletion(void); void display_room_record(void); void display_list(void); int room_found(int); void change_status(int,char); char room_status(int); float get_data(int); private: int recordno(int); void display_record(int); int roomno; char roomcode[5],status; float tariff; }; ///**************************************************************************** ******* /// class name:customer /// details :it contorls over all the functions /// related to customer ///**************************************************************************** ****** class customer { public: void checkin(void); void checkout(void); void modify(void); void deletion(void); void display_list(void); void display_customer_record(void); private: int recordno(int);

void display_record(int); void delete_record(int); int roomno; char name[21],phone[8]; float advance,misc,room_srv; }; ///**************************************************************************** ********* /// class name:account /// details :it controls over all the functions /// related to prepration of bill ///**************************************************************************** ******* class account { public: void prepare_bill(int,float,char t_name [21] ,float,float,float); }; ///**************************************************************************** ************** /// class name:menu /// function name:line_hor /// details:it accepts the rooms and columns and /// draw the horizontal line ///**************************************************************************** ********************** void menu::line_hor(int column1,int column2,int row,char c) { for(column1;column1<=column2;column1++) { gotoxy(column1,row); cout<<c; } } ///**************************************************************************** ************* /// class name :menu /// function name:line_ver /// details :it accepts the rooms and columns and /// draw the vertical line ///**************************************************************************** ************************************ void menu::line_ver(int row1,int row2,int column,char c) {

for(row1;row1<=row2;row1++) { gotoxy(column,row1); cout<<c; } } ///**************************************************************************** ************* /// class name :menu /// function name:box_password /// details :it draws the box for the password ///**************************************************************************** *********** void menu::box_password(void) { line_hor(2,79,1,219); line_hor(2,79,24,219); line_ver(1,24,2,219); line_ver(1,24,79,219); delay(50); line_hor(3,78,2,219); line_hor(3,78,23,219) ; line_ver(2,23,3,219); line_ver(2,23,78,219); delay(50); line_hor(4,77,3,219); line_hor(4,77,22,219); line_ver(3,22,4,219); line_ver(3,22,77,219); delay(50); line_hor(5,76,4,178); line_hor(5,76,21,178); line_ver(4,21,5,178); line_ver(4,21,76,178); delay(50); line_hor(6,75,5,178); line_hor(6,75,20,178); line_ver(5,20,6,178); line_ver(5,20,75,178); delay(50); line_hor(7,74,6,178); line_hor(7,74,19,178); line_ver(6,19,7,178); line_ver(6,19,74,178); delay(50);

line_hor(8,73,7,177); line_hor(8,73,18,177); line_ver(7,18,8,177); line_ver(7,18,73,177); delay(50); line_hor(9,72,8,177); line_hor(9,72,17,177); line_ver(8,17,9,177); line_ver(8,17,72,177); delay(50); line_hor(10,71,9,177); line_hor(10,71,16,177); line_ver(9,16,10,177); line_ver(9,16,71,177); delay(50); } ///**************************************************************************** ********* /// class name :menu /// function nmae :box_menu /// details :it drams the box for the menus ///**************************************************************************** ************** void menu::box_menu(void) { line_hor(2,79,1,219); line_hor(2,79,24,219); line_ver(1,24,2,219); line_ver(1,24,79,219); delay(50); line_hor(3,78,2,178); line_hor(3,78,23,178); line_ver(2,23,3,178); line_ver(3,22,77,177); delay(50); line_hor(4,77,3,177); line_hor(4,77,22,177); line_ver(3,22,4,177); line_ver(3,22,77,177); delay(50); } ///**************************************************************************** ************** /// class name :menu /// function name :enter_password

/// details :it accepts the password and terminates /// the program if wrong entered ///**************************************************************************** *************** void menu::enter_password() { clrscr(); char pass1,pass2,pass3; box_password(); gotoxy(30,12); cout<<"enter the password:"; pass1=getch(); cout<<"*"; pass2=getch(); cout<<"*"; pass3=getch(); cout<<"*"; sound(500); delay(100); nosound(); if (pass1=='h'&&pass2=='m'&&pass3=='s') return; gotoxy(30,12); cout<<"wrong password"; gotoxy(2,1); getch(); exit(0); } ///**************************************************************************** **************** /// class name :menu /// function name :main_menu /// details :it create main menu to control /// functions ///**************************************************************************** ****************** void menu::main_menu(void) { char ch; char h[]={"hotel"}; char m[]={"mangment"}; int j; while(1) { clrscr();

box_menu(); j=9; for(int i=0;h[i]!='\0';i++) { gotoxy(15,j); j++; cout<<h[i]; } j=7; for(i=0;m[i]!='\0';i++) { gotoxy(65,j); j++; cout<<m[i]; } gotoxy(30,5); cout<<"1.check in:"; gotoxy(30,7); cout<<"2.check out"; gotoxy(30,9); cout<<"3.customer record"; gotoxy(30,11); cout<<"4.room record"; gotoxy(30,13); cout<<"5.edit"; gotoxy(30,15); cout<<"6.report"; gotoxy(30,17); cout<<"0.exit to dos"; gotoxy(30,20); cout<<"enter your choice:"; ch=getch(); if (ch=='1') { customer c; c.checkin(); } else if (ch=='2') { customer c; c.checkout() ; } if (ch=='3') {

customer c; c.display_customer_record(); } else if (ch=='4') { room r; r.display_room_record(); } else if ( ch == '5' ) edit_menu(); else if (ch=='6') report_menu(); else if (ch=='0') break; } } ///**************************************************************************** *************** /// class name :menu /// function name :edit_menu /// details :it creats edit menu to control /// functions of room & customer classes ///**************************************************************************** ********* void menu::edit_menu(void) { char ch; while(1) { clrscr(); box_menu(); gotoxy(30,6); cout<<" edit"; gotoxy(30,10); cout<<"2.customer records"; gotoxy(30,12); cout<<"0.exit"; gotoxy(30,15); cout<<"enter your choice: "; ch=getch(); if (ch=='1')

room_edit_menu(); else if(ch=='2') customer_edit_menu(); else if (ch=='0') break; } } ///**************************************************************************** ************************************** /// class name : menu /// function name :room_edit_menu /// details :it create edit menu to control /// functions of room class ///**************************************************************************** ********************** void menu::room_edit_menu(void) { char ch; while(1) { clrscr(); box_menu(); gotoxy(30,8); cout<<"1.add room records"; gotoxy(30,10); cout<<"2.modify room records"; gotoxy(30,12); cout<<"3.delete room records"; gotoxy(30,14); cout<<"0.exit"; gotoxy(30,17); cout<<"enter your choice:"; ch= getch(); if (ch=='1') { room r; r.add(); } else if (ch=='3') { room r; r.deletion();

} else if (ch=='0') break; } } ///**************************************************************************** ************** /// class name :menu /// function nmae :customer_edit_menu /// details :it create edit menu to control /// functions of customer class ///**************************************************************************** ********************* void menu::customer_edit_menu(void) { char ch; while(1) { clrscr(); box_menu(); gotoxy(30,8); cout<<"1.modify customer records"; gotoxy(30,10); cout<<"2.delete customers records"; gotoxy(30,12); cout<<"0.exit"; gotoxy(30,15); cout<<"enter your choice:"; ch=getch(); if (ch=='1') { customer c; c.modify(); } else if (ch=='2') { customer c; c.deletion(); } else if (ch=='0') break; }

} ///**************************************************************************** ************************ /// class name :menu /// function name :report_menu /// details :it create report menu to display the /// report of rooms and customers ///**************************************************************************** ************************* void menu::report_menu(void) { char c,ch; while(1) { clrscr(); box_menu(); gotoxy(30,8); cout<<"1.list of rooms"; gotoxy(30,10); cout<<"2.list of customers"; gotoxy(30,12); cout<<"0.exit"; gotoxy(30,15); cout<<"enter your choice:"; ch=getch(); if (ch=='1') { room r; r.display_list(); } else if (ch=='2') { customer c; c.display_list(); } else if (ch=='0') break; } } ///**************************************************************************** *********** /// class name :room

/// function name :room_found /// details :it returns the value 1 if given room /// no. found ///**************************************************************************** ************** int room::room_found(int t_roomno) { fstream file; file.open("room.dat",ios::in); file.seekg(0); int found=0; while (file.read((char*)this,sizeof(room))) { if(roomno==t_roomno) found=1; } file.close(); return found; } ///**************************************************************************** ***************************************************************************** ***************************************************************************** ***************************************************************************** ***************************************************************************** ***************************************************************************** ***************************************************************************** *********************** /// class name :room /// function name :display_list /// details :it displays the list of the room ///**************************************************************************** ************************************************* void room::display_list(void) { clrscr(); float tarriff; fstream file; file.open("room.dat",ios::in); file.seekg(0); int row=5,found=0,pageno=1; gotoxy(18,1); cout<<"list of rooms"; gotoxy(1,3); cout<<"room code room no. status tarrrif ";

while(file.read((char *)this,sizeof(room))) { delay(20); found=1; gotoxy(2,row); cout<<roomcode; gotoxy(16,row); cout<<roomno; gotoxy(29,row); cout<<status; gotoxy(42,row); cout<<tarriff; if (row==23) { row=5; gotoxy(66,1); cout<<"page no.:"<<pageno; pageno++; gotoxy(1,25); cout<<"press any key to continue..."; getch(); clrscr(); gotoxy(18,1); cout<<"list of rooms"; gotoxy(1,3); cout<<"room code room no. status } else row++; } if (!found) { sound(500); delay(100); nosound(); gotoxy(1,5); cout<<"records not found"; } gotoxy(66,1); cout<<"page no.:"<<pageno; gotoxy(1,25); cout<<"press any key to continue..."; getche(); file.close();

tarrif ";

} ///**************************************************************************** *************** /// class name : room /// function name :recordno /// details :it returns the record no. of the given /// room no. ///**************************************************************************** ********** int room :: recordno(int t_roomno) { fstream file; int count; file.open("room.dat",ios::in); file.seekg(0); while (file.read((char *)this,sizeof(room))) { count++; if (t_roomno==roomno) break; } file.close(); return count; } ///**************************************************************************** ********************** /// class name :room /// function name :display_record /// details :it displays the record of the given /// room no. ///**************************************************************************** ********* void room::display_record(int t_roomno) { fstream file; file.open("room.dat",ios::in); file.seekg(0); int found=0; while (file.read((char *)this,sizeof(room))&&!found) { if(t_roomno==roomno) { found=1; gotoxy(1,5); cout<<"room code:"<<roomcode;

gotoxy(1,6); cout<<"room no. :"<<status; gotoxy(1,8); cout<<"tarrif :"<<tariff; } } file.close(); } ///**************************************************************************** ************* /// class name :room /// function name :display_room_info /// details :it gives room no. to display the room /// record. ///**************************************************************************** **************** void room::display_room_record(void) { clrscr(); int valid; int t_roomno; gotoxy(1,3); cout<<"enter the room no.:"; cin>>t_roomno; if (!room_found(t_roomno)) { sound(500); delay(100); nosound(); gotoxy(1,25);clreol(); gotoxy(1,24); cout<<"room no. not found"; gotoxy(1,25); cout<<"press any key to continue..."; getche(); return; } clrscr(); gotoxy(5,3); cout<<"room record"; display_record(t_roomno); gotoxy(1,25); cout<<"press any key to continue..."; getch(); }

///**************************************************************************** ************************ /// class name :room /// function name :change_status /// details :it changes the status of the given /// room to the given status. ///**************************************************************************** ********************** void room::change_status(int t_roomno,char t_status) { int recno; recno=recordno(t_roomno); fstream file; file.open ("room.dat",ios::out | ios::ate); int location; location=(recno-1)*sizeof(room); file.seekp(location); status=t_status; file.write((char *)this,sizeof(room)); file.close(); } ///**************************************************************************** ************************************** /// class name :room /// function nmae :room_status /// details :it returns the status of the given /// room no. ///**************************************************************************** ************************************* char room::room_status(int t_roomno) { fstream file; file.open("room.dat",ios::in); file.seekg(0); int found=0; char t_status; while (file.read((char *)this,sizeof(room))&& !found) { if(t_roomno==roomno) { found=1; t_status=status; } } file.close();

return t_status; } ///**************************************************************************** ************ /// class name :room /// function name :get_data /// details :it returns the tariff of the given /// room no. ///**************************************************************************** ************* float room::get_data(int t_roomno) { fstream file; file.open("room.dat",ios::in); file.seekg(0); float t_tariff; while (file.read((char *) this,sizeof(room))) { if (t_roomno==roomno) { t_tariff=tariff; break; } } file.close(); return t_tariff; } ///**************************************************************************** *************************** /// class name :room /// function nmae :add /// details :it adds the room record to yhe room /// file(room.dat). ///**************************************************************************** ****************** void room::add(void) { char ch; fstream file; int count; char t_rcode[5]; int t_roomno; char t_status; float t_tariff;

do { fstream file; file.open("room.dat",ios::out | ios::app); clrscr(); gotoxy(1,1); cout<<"enter the details for thr room"; gotoxy(1,3); cout<<"code : " ; gotoxy(1,4); cout<<"room no. : " ; gotoxy(1,5); cout<<"status : "; gotoxy(1,6); cout<<"tariff : "; gotoxy(20,11); cout<<"ss :single suit"; gotoxy(20,12); cout<<"sr :single room"; gotoxy(20,13); cout<<"dr :double room"; gotoxy(20,14); cout<<"ds :double suit"; int valid=0; do { valid=1; gotoxy(1,25); cout<<"enter the room code(ss/sr/dr/ds)"; gotoxy(13,3); cin>>t_rcode; strupr(t_rcode); char*string[4]={"ss","dr","sr","ds"}; int result,count=0;; for(int i=0;i<4;i++) { result=strcmpi(t_rcode,string[i]); if (result!=0) count++; } gotoxy(1,25); cout<<"press any key to continue..."; getche(); gotoxy(1,24); clreol(); gotoxy(1,25); clreol();

gotoxy(13,4);

clreol();

}while(! valid); do { valid=1; gotoxy(1,25); clreol(); gotoxy(1,25); cout<<"enter the room status : v=vacant, o=occupied"; gotoxy(13,5); cin>>t_status; t_status=toupper(t_status); if (t_status !='0' && t_status !='v') { valid=0; sound(500); delay(100); nosound(); gotoxy(1,25); clreol(); gotoxy(1,24); cout<<"invalid data entered"; gotoxy(1,25); cout<<"press any key to continue..."; getche(); gotoxy(1,24); clreol(); gotoxy(1,25); clreol(); gotoxy(13,5); clreol(); } }while(! valid); do { valid=1; gotoxy(1,25); clreol(); gotoxy(1,25); cout<<"enter the tariff for the room"; gotoxy(13,6); cin>>t_tariff; if(t_tariff<=0) { valid=0; sound(500); delay(100); nosound(); gotoxy(1,25); clreol(); gotoxy(1,24); cout<<"it should not be negative or zero"; gotoxy(1,25);

cout<<"press any key to continue..."; getche(); gotoxy(1,24); clreol(); if(count==4) { valid=0; sound(500); delay(100); nosound(); gotoxy(1,25);clreol(); gotoxy(1,24); cout<<"invalid code"; gotoxy(1,25); cout<<"press any key to continue..."; getche(); gotoxy(1,24);clreol(); gotoxy(1,25);clreol(); gotoxy(13,3);clreol(); } } } while (valid==0); for(int i=11;i<14;i++) { gotoxy(1,i); clreol(); } do { valid=1; gotoxy(1,25);clreol(); gotoxy(1,25); cout<<"enter the room number"; gotoxy(13,4); cin>>t_roomno; if (t_roomno<=0 || t_roomno>900) { valid=0; sound(500); delay(100); nosound(); gotoxy(1,25);clreol(); gotoxy(1,24); cout<<"it should not be negative or zero or greater than 900"; gotoxy(1,25); cout<<"press any key to continue..."; getche(); gotoxy(1,24); clreol();

gotoxy(1,25); clreol(); gotoxy(13,4); clreol(); } if (room_found(t_roomno)) { valid=0; sound(500); delay(100); nosound(); gotoxy(1,25); clreol(); gotoxy(1,24); cout<<"room no. already exit"; gotoxy(1,25); clreol(); } }while(!valid); gotoxy(1,8); cout<<"do you want to save the record (y/n) :"; do { valid=1; gotoxy(42,8); ch=getche(); ch=toupper(ch); if (ch!='y'&& ch !='n') { valid=0; sound(500); delay(100); nosound(); gotoxy(42,8); clreol(); } }while(! valid); if (ch=='y') { strcpy(roomcode,t_rcode); roomno=t_roomno; status=t_status; tariff=t_tariff; file.write((char *) this,sizeof(room)); } gotoxy(1,9); cout<<"do you want to add mare records(y/n): "; do { valid=1; gotoxy(42,9);

ch=getche(); ch=toupper(ch); if(ch!='y'&& ch!='n') { valid=0; sound(500); delay(100); nosound(); gotoxy(42,9); clreol(); } }while(!valid); file.close(); }while(ch =='y'); } ///**************************************************************************** *************** /// class name :room /// function name :modify /// details :it modify the room record in the room /// file(room.dat). ///**************************************************************************** ***************************************************** void room::modify(void) { clrscr(); int valid; char ch; char t_rcode[5]; int t_roomno,tr; char t_status; fstream file; float t_tariff; file.open ("room.dat",ios::out|ios::ate); gotoxy(1,3); cout<<"enter the room no. to be modified"; cin>>tr; if (!room_found(tr)) { sound(500); delay(100); nosound(); gotoxy(1,25);clreol(); gotoxy(1,24); cout<<"room no> not found"; gotoxy(1,25);

cout<<"press ang key to continue..."; getche(); return; } display_record(tr); gotoxy(1,10); cout<<"do you want to modify this room record(y/n):"; do { valid=1; gotoxy(48,10); ch=toupper(ch); if( ch!='y' && ch!='n') { valid=0; sound(500); delay(100); nosound(); gotoxy(42,9); } }while (!valid); if (ch=='n'); return; gotoxy(1,12); cout<<"enter the new data for the room"; cout<<"room no. : "; gotoxy(1,16); cout<<"status : "; gotoxy(1,17); cout<<"tarriff : "; do { valid=1; gotoxy(1,25); cout<<"enter the room code(ss/sr/dr/ds)"; gotoxy(13,14); cin>>t_rcode; strupr(t_rcode); char *string[4]={"ss","dr","sr","ds"}; int result,count=0; for( int i=0;i<4;i++) { result=strcmpi(t_rcode,string[i]); if (result!=0) count++; }

if (count==4) { valid=0; sound(500); delay(100); nosound(); gotoxy(1,25); clreol(); gotoxy(1,24); cout<<"invalid code"; gotoxy(1,25); cout<"press ang key to continue..."; getche(); gotoxy(1,24); clreol(); gotoxy(1,25); clreol(); gotoxy(13,14); clreol(); } }while(valid==0); do { valid=1; gotoxy(1,25);clreol(); gotoxy(1,25); cout<<"enter the room number"; gotoxy(13,15); cin>>t_roomno; if (t_roomno<=0 || t_roomno>900) { valid=0; sound(500); delay(100); nosound(); gotoxy(1,25); clreol(); gotoxy(1,24); cout<<"it should not be negative or zero greater than 900"; gotoxy(1,25); cout<<"press any key to continue..."; getche(); gotoxy(1,24); clreol(); gotoxy(1,25); clreol(); gotoxy(13,15); clreol(); } if (room_found(t_roomno)&&t_roomno!=tr) { valid=0; sound(500);

delay(100); nosound(); gotoxy(1,25); clreol(); gotoxy(1,24); cout<<"room no. already exist"; gotoxy(1,25); cout<<"press any key to continue..."; getche(); gotoxy(1,24); clreol(); gotoxy(1,25); clreol(); gotoxy(13,15); clreol(); } }while(!valid); do { valid=1; gotoxy(1,25); clreol(); gotoxy(1,25); cout<<"enter the room status : v=vacent,o=occupied"; gotoxy(13,16); cin>>t_status; t_status=toupper(t_status); if(t_status!='0'&&t_status!='v') { valid=0; sound(500); delay(100); nosound(); gotoxy(1,25); clreol(); gotoxy(1,24); cout<<"invalid data entered"; gotoxy(1,25); cout<<"press ang key to continue..."; getche(); gotoxy(1,24); clreol(); gotoxy(1,25); clreol(); gotoxy(13,16); clreol(); } }while(!valid); do { valid=1; gotoxy(1,25); clreol(); gotoxy(1,25); cout<<"enter the tariff for the room"; gotoxy(13,17);

cin>>t_tariff; if (t_tariff<=0) { valid=0; sound(500); delay(100); nosound(); gotoxy(1,25); clreol(); gotoxy(1,24); cout<<"it should not be negative or zero"; gotoxy(1,25); cout<<"press ang key to contonue..."; getche(); gotoxy(1,24); clreol(); gotoxy(1,25); clreol(); gotoxy(13,17); clreol(); } }while(!valid); gotoxy(1,19); cout<<"do you want to save the record (y/n) : "; do { valid=1; gotoxy(42,19); ch=getche(); ch=toupper(ch); if (ch !='y' && ch!='n') { valid=0; sound(500); delay(100); nosound(); gotoxy(42,19); clreol(); } }while(! valid); if (ch=='y') { int recno; recno=recordno(tr); int location; location =(recno-1)*sizeof(room); file.seekp(location); strcpy(roomcode,t_rcode); roomno=t_roomno; status=t_status; tariff=t_tariff;

file.write((char *) this,sizeof(room)); } file.close(); } ///**************************************************************************** ******************** /// class name :room /// function nmae :deletion /// details :it delets the room record in the room /// file(room.dat) ///**************************************************************************** ******************* void room::deletion(void) { clrscr(); char ch; int valid; int t_roomno; do{ gotoxy(1,3); cout<<"enter the room no. to be deleted"; cin>>t_roomno; if(!room_found(t_roomno)) { sound(500); delay(100); nosound(); gotoxy(1,25); clreol(); gotoxy(1,24); cout<<"room no. not found"; gotoxy(1,25); cout<<"press any key to continue..."; getche(); return; } display_record(t_roomno); gotoxy(48,10); ch=getche(); ch=toupper(ch); if(ch!='y' && ch!='n') { valid=0; sound(500); delay(100); nosound(); gotoxy(42,9); clreol();

} }while(!valid); if (ch=='n') return; fstream file; file.open("room.dat",ios::in); fstream temp; temp.open("temp.dat",ios::out); while(!file.eof()) { file.read((char *)this,sizeof(room)); if(file.eof()) break; if (roomno!=t_roomno) temp.write((char *) this,sizeof(room)); } file.close(); temp.close(); file.open("room.dat",ios::out); temp.open("temp.dat",ios::in); temp.seekg(0); while(!temp.eof()) { temp.read((char*)this,sizeof(room)); if(temp.eof()) break; file.write((char*)this,sizeof(room)); } file.close(); temp.close(); } ///**************************************************************************** ************************ /// class name :customer /// function nmae :display_list /// details :it displays the list of the customer /// records ///**************************************************************************** *************** void customer::display_list(void) { clrscr(); fstream file; file.open("customer.dat",ios::in); file.seekg(0);

int row=5,found=0,pageno=1,total=0; gotoxy(18,1); cout<<"list of customers"; gotoxy(1,3); cout<<"room no. name phone room service advance misc."; while(file.read((char*)this,sizeof(customer))) { total++; delay(20); found-1; gotoxy(2,row); cout<<roomno; gotoxy(12,row); puts(name); fflush(stdout); gotoxy(34,row); cout<<phone; gotoxy(47,row); cout<<room_srv; gotoxy(62,row); cout<<advance; gotoxy(71,row); cout<<misc; if( row==23) { row=5; gotoxy(66,1); cout<<"page no.:"<<pageno; pageno++; gotoxy(1,25); cout<<"press ang key to continue..."; getche(); clrscr(); gotoxy(18,1); cout<<"list of customers"; gotoxy(1,3); cout<<" room no. name phone room service advance misc."; } else row++; } if (!found) { sound(500); delay(100); nosound();

gotoxy(1,5); cout<<"recods not found"; } gotoxy(66,1); cout<<"page no.: " <<pageno; gotoxy(1,25); cout<<"press ang key to continue..."; getche(); clrscr(); gotoxy(5,5); cout<<"total no. of customers="<<total; gotoxy(1,25); cout<<"press ang key to continue..."; getche(); file.close(); } ///**************************************************************************** ****************************** /// class name :customer /// function nmae :checkin /// details :it adds the records in the customer /// file(customer.dat) ///**************************************************************************** ************* void customer::checkin(void) { room r; char ch; int valid=1; int t_roomno,t_no_cust; char t_name[21],t_address[35],t_phone[12], t_nation[16],t_passport[30]; float t_advance,t_misc,t_room_srv; clrscr(); gotoxy(1,1); cout<<"enter the details of the customer"; gotoxy(1,3); cout<<"room no. :"; gotoxy(1,4); cout<<"name :"; gotoxy(1,5); cout<<"no. of guests :"; gotoxy(1,6); cout<<"address :"; gotoxy(1,7);

cout<<"phone :"; gotoxy(1,8); cout<<"nationality :"; gotoxy(1,9); cout<<"advance :"; gotoxy(1,11); cout<<"miscellinous :"; gotoxy(1,12); cout<<"room service :"; gotoxy(20,3); cin>>t_roomno; char t_status; t_status=r.room_status(t_roomno); if (!r.room_found(t_roomno) || t_status=='0') { sound(500); delay(100); nosound(); gotoxy(1,25); clreol(); gotoxy(1,24); cout<<"room no. not found or not vacent"; gotoxy(1,25); getche(); return; } do { valid=1; gotoxy(1,25); clreol(); gotoxy(1,25); cout<<"enter the name of the customer"; gotoxy(20,4); gets(t_name); strupr(t_name); fflush(stdin); if ((strlen(t_name) <=0)||(strlen(t_name) >20)) { valid=0; sound(500); delay(100); nosound(); gotoxy(1,25); clreol(); gotoxy(1,24); cout<<"length should not be zero or greater than 20"; gotoxy(1,25); cout<"press any key to continue";

getche(); gotoxy(1,24); clreol(); gotoxy(1,25); clreol(); gotoxy(20,4); clreol(); } }while(! valid); do { valid=1; gotoxy(1,25); clreol(); gotoxy(1,25); cout<<"enter rhe no. of guests with the customers"; gotoxy(20,5); cin>>t_no_cust; if((t_no_cust<0) ||(t_no_cust>4)) { valid=0; sound(500); delay(100); nosound(); gotoxy(1,25); clreol(); gotoxy(1,24); cout<<"guests should not be less than 0 or greater than 4"; gotoxy(1,25); cout<<"press any key to continue..."; getche(); gotoxy(1,24); clreol(); gotoxy(1,25); clreol(); gotoxy(20,5); clreol(); } }while(!valid); do { valid=1; gotoxy(1,25); clreol(); gotoxy(1,25); cout<<"enter the address of the customer"; gotoxy(20,6); gets(t_address); fflush(stdin); if ((strlen (t_address)<=0) ||(strlen(t_address))>50) { valid=0; sound(500); delay(100); nosound();

gotoxy(1,25); clreol(); gotoxy(1,24); cout<<"length should not be zero or greater than 50"; gotoxy(1,25); cout<<"press any key to continue..."; getche(); gotoxy(1,24); clreol(); gotoxy(1,25); clreol(); gotoxy(20,6); clreol(); } }while(! valid); do { valid=1; gotoxy(1,25); clreol(); gotoxy(9,25); cout<<"enter the phone no. of the customer, enter'-' for no phone no."; gotoxy(20,7); cin>>t_phone; if((strlen(t_phone)<7&& strlen (t_phone)>1) || (strlen (t_phone)>7)) { valid=0; sound(500); delay(100); nosound(); gotoxy(1,25); clreol(); gotoxy(1,24); cout<<"length should not less than 7 or greater than 7"; gotoxy(1,25); cout<<"press any key to continue..."; getche(); gotoxy(1,24); clreol(); gotoxy(1,25); clreol(); gotoxy(20,7); clreol(); } }while(!valid); do { valid=1; gotoxy(1,25); clreol(); gotoxy(1,25); cout<<"enter nationality of the customer"; gotoxy(20,8); gets(t_nation); fflush(stdin); if((strlen (t_nation)<=0 ||(strlen(t_nation)>15)))

{ valid=0; sound(500); delay(100); nosound(); gotoxy(1,25); clreol(); gotoxy(1,24); cout<<"length should not less than zero or greater than 15"; gotoxy(1,25); cout<<"press ang key to continue..."; getche(); gotoxy(1,24); clreol(); gotoxy(1,25); clreol(); gotoxy(20,8); clreol(); } }while(! valid); do { valid=1; gotoxy(1,25); clreol(); gotoxy(1,25); cout<<"enter the passport no. of the customer"; gotoxy(20,9); gets(t_passport); fflush(stdin); if ((strlen (t_passport)<=0 ||(strlen(t_passport)>15))) { valid=0; sound(500); delay(100); nosound(); gotoxy(1,25); clreol(); gotoxy(1,24); cout<<"length should not less than zero or greater than 15"; gotoxy(1,25); cout<<"press ang key to continue..."; getche(); gotoxy(1,24); clreol(); gotoxy(1,25); clreol(); gotoxy(20,9); clreol(); } }while(! valid); do { valid=1; gotoxy(1,25); clreol();

gotoxy(1,25); cout<<"enter the advance rs."; gotoxy(20,11); cin>>t_advance; if (t_advance<0) { valid=0; sound(500); delay(100); nosound(); gotoxy(1,25); clreol(); gotoxy(1,24); cout<<"should noy less than zero"; gotoxy(1,25); cout<<"press ang key to continue..."; getche(); gotoxy(1,24); clreol(); gotoxy(1,25); clreol(); gotoxy(20,11); clreol(); } }while(! valid); do { valid=1; gotoxy(1,25); clreol(); gotoxy(1,25); cout<<"enter the miscallenious charges"; gotoxy(20,12); cin>>misc; if(t_misc<0) { valid=0; sound(500); delay(100); nosound(); gotoxy(1,25); clreol(); gotoxy(1,24); cout<<"should not less than zero"; gotoxy(1,25); cout<<"press ang key to continue..."; getche(); gotoxy(1,24); clreol(); gotoxy(1,25); clreol(); gotoxy(20,12); clreol(); } }while(!valid);

do { valid=1; gotoxy(1,25);clreol(); gotoxy(1,25); cout<<"enter the room service charges"; gotoxy(20,13); cin>>t_room_srv; if(t_room_srv<0) { valid=0; sound(500); delay(100); nosound(); gotoxy(1,25); clreol(); gotoxy(1,24); cout<<"should not less than zero"; gotoxy(1,25); cout<<"press any key to continue..."; getche(); gotoxy(1,24); clreol(); gotoxy(1,25); clreol(); gotoxy(20,13); clreol(); } }while(! valid); gotoxy(1,15); cout<<"do you want to save the record (y/n) : "; do { valid =1; gotoxy(42,15); ch=getche(); ch=toupper(ch); if(ch!='y' && ch!='n') { valid=0; sound(500); delay(100); nosound(); gotoxy(42,15); clreol(); } }while(! valid); if(ch=='y') { r.change_status(t_roomno,'0'); roomno=t_roomno;

strcpy(phone,t_phone); advance=t_advance; misc=t_misc; room_srv=t_room_srv; fstream file; file.open("customer .dat",ios::out |ios::app); file.write((char*) this,sizeof (customer)); file.close(); } } ///**************************************************************************** ********** /// class name :customer /// function name :display_record /// details :it displays the records of vthe customer /// in the given room no. ///**************************************************************************** ********** void customer :: display_record(int t_roomno) { fstream file; file.open("customer.dat",ios::in); file.seekg(0); int found=0; while (file.read((char *) this,sizeof(customer)) && !found) { if(t_roomno==roomno) { found=1; gotoxy(1,5); cout<<"room no. :"<<roomno; gotoxy(1,6); cout<<"customer name :"<<name; gotoxy(1,7); cout<<"phone no. :"<<phone; gotoxy(1,8); cout<<"advance :"<<advance; gotoxy(1,9); cout<<"misc. charges :"<<misc; gotoxy(1,10); cout<<"room service charges:"<<room_srv; } } file.close(); }

///**************************************************************************** *************** /// class name :customer /// function name :recordno /// details :it returns the record no. of the given /// room no. in the customer's file ///**************************************************************************** ********** int customer ::recordno(int t_roomno) { fstream file; file.open("customer.dat",ios::in); file.seekg(0); int count=0; while(file.read ((char *)this,sizeof(customer))) { count++; if (t_roomno==roomno) break; } file.close(); return count; } ///**************************************************************************** ********* /// class name :customer /// function name :modify /// details :it modify the customer's records in /// the customer's file(customer.dat) ///**************************************************************************** **************** void customer :: modify(void) { clrscr(); room r; int valid; char ch; int t_roomno,tr; char t_name[21],t_phone[8]; float t_advance,t_misc,t_room_srv; fstream file; file.open ("customer.dat",ios::out | ios::ate); gotoxy(1,3); cout<<"enter the room no. of the customer to be modified"; cin>>tr;

char t_status; t_status=r.room_status(tr); if(! r.room_found(tr)|| t_status=='v') { sound(500); delay(100); nosound(); gotoxy(1,25); clreol(); gotoxy(1,24); cout<<"room no. not found or room is vacent"; gotoxy(1,25); cout<<"press ang key to continue..."; getche(); return; } display_record(tr); gotoxy(1,12); cout<<"do you want to modify this room record(y/n):"; do { valid=1; gotoxy(48,12); ch=getche(); ch=toupper(ch); if(ch !='y' && ch!='n') { valid=0; sound(500); delay(100); nosound(); gotoxy(42,12); clreol(); } } while (! valid); if (ch=='n') return; gotoxy(1,14); cout<<"enter the new data for the customer"; gotoxy(1,16); cout<<"room no. :"; gotoxy(1,17); cout<<"name :"; gotoxy(1,18); cout<<"phone :"; gotoxy(1,19);

cout<<"advance :"; gotoxy(1,20); cout<<"miscellineous :"; gotoxy(1,21); cout<<"room service :"; do { valid=1; gotoxy(1,25);clreol(); gotoxy(1,25); cout<<"enter the room number for customer "; gotoxy(20,16); cin>>t_roomno; t_status=r.room_status(t_roomno); if ((! r.room_found(t_roomno)) || (r.room_found(t_roomno) && t_roomno!=tr && t_status=='0')) { valid=0; sound(500); delay(100); nosound(); gotoxy(1,25); clreol(); gotoxy(1,24); cout<<"room no. not exit or not vacent "; gotoxy(1,25); cout<<"press ang key to continue ..."; getche(); gotoxy(1,24); clreol(); gotoxy(1,25); clreol(); gotoxy(20,16);clreol(); } }while(! valid); do { valid=1; gotoxy(1,25); clreol(); gotoxy(1,25); cout<<"enter the name of the customer "; gotoxy(20,17); gets(t_name); fflush(stdin); if ((strlen (t_name)<=0||(strlen (t_name)>20))) { valid=0; sound(500);

delay(100); nosound(); gotoxy(1,25); clreol(); gotoxy(1,24); cout<<"length should not be zero or greater than 20"; gotoxy(1,25); cout<<"press any key to continue..."; getche(); gotoxy(1,24); clreol(); gotoxy(1,25); clreol(); gotoxy(20,17);clreol(); } }while(! valid); do { valid=1; gotoxy(1,25); clreol(); gotoxy(1,25); cout<<"enter the phone no. of the customer,enter '-' for no phone no>"; gotoxy(20,18); cin>>t_phone; if ((strlen (t_phone)<7 && strlen (t_phone)> 1|| ( strlen (t_phone)>7))) { valid=0; sound(500); delay(100); nosound(); gotoxy(1,25); clreol(); gotoxy(1,24); cout<<"length should not less than 7 or greater than 7"; gotoxy(1,25); cout<<"press ang key to contonue..."; getche(); gotoxy(1,24); clreol(); gotoxy(1,25); clreol(); gotoxy(20,18);clreol(); } }while (! valid); do { valid=1; gotoxy(1,25); clreol(); gotoxy(1,25); cout<<"enter the advance rs.";

gotoxy(20,19); cin>>t_advance; if(t_advance<0) { valid=0; sound(500); delay(100); nosound(); gotoxy(1,25); clreol(); gotoxy(1,24); cout<<"should not less than zero"; gotoxy(1,25); cout<<"press any key to continue.."; getche(); gotoxy(1,24); clreol(); gotoxy(1,25); clreol(); gotoxy(20,19);clreol(); } }while ( ! valid); do { valid=1; gotoxy(1,25); clreol(); gotoxy(1,25); cout<<"enter the miscallenious charges "; gotoxy(20,20); cin>>t_misc; if (t_misc<0) { valid=0; sound(500); delay(100); nosound(); gotoxy(1,25); clreol(); cout<<"should not less than zero"; gotoxy(1,25); cout<<"press ang key to continue..."; getche(); gotoxy(1,24); clreol(); gotoxy(1,25); clreol(); gotoxy(20,20);clreol(); } }while(! valid); do { valid=1;

gotoxy(1,25); clreol(); gotoxy(1,25); cout<<"enter the room service cxharges"; gotoxy(20,21); cin>>t_room_srv; if (t_room_srv<0) { valid=0; sound(500); delay(100); nosound(); gotoxy(1,25); clreol(); gotoxy(1,24); cout<<"should not less than zero"; gotoxy(1,25); cout<<"press any key to continue..."; getche(); gotoxy(1,24); clreol(); gotoxy(1,25); clreol(); gotoxy(20,21);clreol(); } }while(! valid); gotoxy(1,23); cout<<"do you want to save the record(y/n):"; do { valid=1; gotoxy(42,23); ch=getche(); ch=toupper(ch); if(ch != 'y' && ch !='n') { valid=0; sound(500); delay(100); nosound(); gotoxy(42,23);clreol(); } }while (! valid); if (ch=='y'); { if(t_roomno !=tr) { r.change_status(t_roomno,'0'); r.change_status(tr,'v'); }

int recno; recno=recordno(tr); int location; location=(recno-1)* sizeof(customer); file.seekp(location); roomno=t_roomno; strcpy(name,t_name); strcpy(phone,t_phone); room_srv=t_room_srv; advance=t_advance; misc=t_misc; file.write((char *)this,sizeof(customer)); } file.close(); } ///**************************************************************************** *********** /// class name :customer /// function nmae :delete_record /// details :it delets the customer's record in /// the customer's file(customer.dat)of /// the given room no. ///**************************************************************************** ******************* void customer::delete_record(int t_roomno) { fstream file; file.open("customer.dat",ios::in); fstream temp; temp.open("temp.dat",ios::out); while(! file.eof() ) { file.read((char *) this,sizeof(customer)); if (file.eof() ) break; if (roomno !=t_roomno) temp.write((char *) this,sizeof(customer)); } file.close(); temp.close(); } ////*************************************************************************** ******** /// class name :customer /// function nmae :display_customer_record

/// details :it gives the room no. of the customer /// to display the customer record ///**************************************************************************** **************** void customer::display_customer_record(void) { clrscr(); room r; int valid; int t_roomno; gotoxy(1,3); cout<<"enter the room no. of the customer:"; cin>>t_roomno; char t_status; t_status=r.room_status(t_roomno); if(! r.room_found(t_roomno)|| t_status=='v') { sound(500); delay(100); nosound(); gotoxy(1,25); clreol(); gotoxy(1,24); cout<<"room no. not found or room is vacent "; gotoxy(1,25); cout<<"press ang key to continue..."; getche(); return; } clrscr(); gotoxy(5,3); cout<<"customer record"; display_record(t_roomno); gotoxy(1,25); cout<<"press ang key to continue..."; getch(); } ///**************************************************************************** ********************** /// class name :customer /// function nmae :deletion /// details :it gives the room no. of the customer /// to delete the customer recrord ///**************************************************************************** ****** void customer::deletion(void)

{ clrscr(); room r; int valid; char ch; int t_roomno; gotoxy (1,3); cout<<"enter the room no. of the customer to be deleted"; cin>>t_roomno; char t_status; t_status=r.room_status(t_roomno); if(! r.room_found(t_roomno)|| t_status=='v') { sound(500); delay(100); nosound(); gotoxy(1,25); clreol(); gotoxy(1,24); cout<<"room no. not found or room is vacent"; gotoxy(1,25); cout<<"press any key to continue..."; getche(); return; } display_record(t_roomno); gotoxy(1,15); cout<<"do you want this customer record(y/n):"; do { valid=1; gotoxy(52,15); ch=getche(); ch=toupper(ch); if (ch!= 'y' && ch!='n') { valid=1; sound(500); delay(100); nosound(); gotoxy(52,15);clreol(); } }while (! valid); if (ch=='n') return; r.change_status(t_roomno,'v');

delete_record(t_roomno); } ///**************************************************************************** ************************* /// class name :customer /// function nmae :checkout /// details :it gives the data of the customer to // prepare bill of the customer and also /// delete the customer's record ///**************************************************************************** ******** void customer::checkout(void) { clrscr(); room r; int valid; char ch; int t_roomno; gotoxy(1,3); cout<<"enter the room no. of the customer to be check out:"; cin>>t_roomno; char t_status; t_status=r.room_status(t_roomno); if(! r.room_found(t_roomno) || t_status=='v') { sound(500); delay(100); nosound(); gotoxy(1,25); clreol(); gotoxy(1,24); cout<<"room no. not found or room is vacent"; gotoxy(1,25); cout<<"press any key to continue..."; getche(); return; } display_record(t_roomno); gotoxy(1,15); cout<<"do you want to prepare bill of this customer record(y/n):"; do { valid=1; gotoxy(63,15); ch=getche(); ch=toupper(ch); if (ch !='y' && ch !='n')

{ valid=1; gotoxy(63,15); ch=getche(); ch=toupper(ch); if(ch !='y' && ch!='n') { valid=0; sound(500); delay(100); nosound(); gotoxy(63,15); clreol(); } }while(! valid); if (ch=='n') return; fstream file; file.open("customer.dat",ios::in); file.seekg(0); char t_name[21]; float t_advance,t_room_srv,t_misc,t_tariff; while(file.read((char *) this,sizeof(customer))) { if(t_roomno==roomno) { strcpy(t_name,name); t_advance=advance; t_room_srv=room_srv; t_misc=misc; break; } } file.close(); t_tariff=r.get_data(t_roomno); account a; a.prepare_bill(t_roomno,t_tariff,t_name,t_advance,t_room_srv,t_misc); r.change_status(t_roomno,'v'); delete_record(t_roomno); gotoxy(1,25); cout<<"press ang key to continue..."; getche(); }while(1); } ///**************************************************************************** *********** /// class name :account

/// function nmae :prepare /// details :it acepts the data of the customer & /// prepare bill of the customer & also /// creates bill slip ///**************************************************************************** **************************************************************** void account::prepare_bill(int t_roomno,float t_tariff,char t_name[21],float t_advance,float t_room_srv,float t_misc) { int valid; int days; float tax,total; gotoxy(1,17); cout<<"enter the no. of days:"; do { valid=1; gotoxy(25,17); cin>>days; if (days<0 || days>999) { valid=0; sound(500); delay(100); nosound(); gotoxy(1,25); clreol(); gotoxy(1,24); cout<<"should not less than zero"; gotoxy(1,24); cout<<"press any key to continue..."; getche(); gotoxy(1,24); clreol(); gotoxy(1,25); clreol(); gotoxy(25,17); clreol(); } }while(! valid); t_tariff=t_tariff*days; total=total*0.22; total=total+tax; clrscr(); menu m; m.line_hor(2,59,1,15); m.line_hor(2,59,24,15); m.line_ver(1,24,2,15); m.line_ver(1,24,59,15);

gotoxy(5,3); cout<<"bill of room no. :"<<t_roomno; gotoxy(5,6); cout<<"nmae of customer :"<<t_name; gotoxy(5,8); cout<<"taroff charges :"<<t_tariff; gotoxy(5,10); cout<<"misc. charges :"<<t_misc; gotoxy(5,12); cout<<"room service charges :"<<t_room_srv; gotoxy(5,14); cout<<"tax :"<<tax; gotoxy(5,16); cout<<"advance :"<<t_advance; gotoxy(5,18); cout<<"-------------------------------------------------------------------"; gotoxy(5,19); cout<<"total bill : "<<total; gotoxy(5,20); cout<<"----------------------------------------------------------------------------"; } ///**************************************************************************** **************** /// function nmae :main /// details :it calls the password function and /// menu function. ///**************************************************************************** ****** void main(void) { menu m; m.enter_password(); m.main_menu(); }

FUTURE ENHANCEMENTS

The proposed system is HOTEL MANAGEMENT SYSTEM. We can enhance this system by including more facilities like increase in the number of options that can be given by a student, the allotment process is fast and user friendly. Providing such features enable the users to include more comments into the system. The development platform used in this software system uses the powerful features of C++ compiler. This system can be maintained with little efforts and additional functional components can be added in future.

CONCLUSION
As already stated computerisation of hotel management system can make the system much efficient and better to control and to easily avail the facilities offered. we tried our best to complete the project as per the requirement of a hotel system. still the option and facilities can be added up to make it even better i.e. the system is quite flexible. This project is successfully completed after a lot of efforts and work hours. this project underwent number of compiling and debugging, removing errors and making it full proof, reliable and user friendable. My computer teacher motivated me to take this project. through this project we can get the result of different function of placement system.

BIBLIOGRAPHY

1. C++ Programming Language (3rd Edition) Addison Wesley, 1997 2. Let us C++

Yaswant Kanetkar 3. Object Oriented Programming with C++ Balaguruswamy, 2nd Edition 4. Object Oriented Programming in C++, Robert Lafore

Das könnte Ihnen auch gefallen