CHAPTER 1: INTRODUCTION In the fast-changing world, information technology and information management are going to play an important role. We are living in the computer age during past some year. The computer has gaining popularity. Computer revolution found its way into almost every aspect of human life and living. A computer is admirably suited to handle any information and hence is an information processor that is, it can receive data, perform some basic operations on that data and produces results according to a predetermined program. The name of project is “FAST FOOD DELIVERY MANAGEMENT SYSTEM”. In this project astrologers will interact to the user for finding a solution to their problems. It is known globally that, in today’s market, it is extremely difficult to start a new small-scale business and live -through the competition from the well-established and settled owners. In fast paced time of today, when everyone is squeezed for time, the majority of people are finicky when it comes to placing a food order. The customers of today are not only attracted because placing an order online is very convenient but also because they have visibility into the items offered, price and extremely simplified navigation for the order. Online ordering system that I am proposing here, greatly simplifies the ordering process for both the customer and the restaurant. System presents an interactive and up-to-date menu with all available options in an easy-to-use manner. Customer can choose one or more its Ems to place an order which will land in the Cart. Customer can view all the order details in the cart before checking out. At the end, customer gets order confirmation details. Once the order is placed it is entered in the database and retrieved in pretty much real time. This allows Restaurant Employees to quickly go through the orders as they are received and process all orders efficiently and effectively with minimal delays and confusion. 1.1: OBJECTIVES Project Objective – 1. This will minimize the number of employees at the back of the counter. 2. The system will help to reduce labor cost involved. 3. The system will be less probable to make mistake, since it’s a machine. 4. This will avoid long queues at the counter due to the speed of execution and number of optimum screens to accommodate the maximum throughput. 5. The structure of the system can be divided into 3 main logical components: • Web Ordering System -provides the functionality for customers to place their order and supply necessary details. • Menu Management -allows the restaurant to control what can be ordered by the customers. • Order Retrieval System -This is a final logical component. Allows restaurant to keep track of all orders placed. This component takes care of order retrieving and displaying order information. Type of approach• Software Based Aim of projectThe Main aim of this project is to develop interaction between customers and restaurants. This will help to reduce labour cost involved. PROTOTYPE MODEL PHASES: ➢ Requirement gathering & analysis: The first phase is requirement gathering phase in which all possible requirements of the system are identified. The software requirement specification is prepared in this phase. ➢ Design: Design focus on program attribute such as data structure, software architecture, interface representation and algorithm details. While designing software new requirements can be identified. ➢ Building prototype: Prototyping has several benefits: the software designer and implementer can get valuable feedback from the users early in the project. The client and the contractor can compare if the software made matches the software specification, according to which the software program is built. ➢ Customer Evaluation: Allows customers to quickly and easily provide feedback to service provider managers. It is designed to improve customer service by allowing managers to monitor the satisfaction levels of services provided through reports and customer comments. ➢ Refining Prototype: If the prototype is to be retained and used to produce the actual system, refinement will continue until the final system is produced. ➢ Engineer Product: Software engineering (SE) is the application of engineering to the development of software in a systematic method. 1.2: PROPOSED METHODOLOGY Developing a desktop application based on the Waterfall Iterative Model would involve following a structured approach that combines the principles of both the Waterfall Model and iterative development. Here's a proposed methodology for developing a desktop application using this model: 1. Requirements Gathering: Engage with stakeholders to understand their needs and gather detailed requirements for the desktop application. Document the requirements, user stories, and use cases. 2. Design: Based on the gathered requirements, design the architecture, user interface, and system components of the desktop application. Create high-level and low-level design documents that provide a blueprint for the implementation. 3. Iterative Implementation: Start implementing the desktop application based on the initial design. Divide the implementation into iterative cycles, where each cycle focuses on developing specific functionality or modules. At the end of each iteration, conduct reviews and gather feedback from stakeholders to refine the implementation. 4. Testing: After each iteration, perform thorough testing of the implemented functionality. Conduct unit testing to verify individual components, integration testing to ensure proper interaction between modules, and system testing to validate the overall behavior of the desktop application. Identify and address any defects or issues found during testing. 5. Deployment: Once the development and testing of all iterations are completed, prepare the desktop application for deployment. This involves packaging the application, creating installation files, and documenting any necessary deployment procedures. 6. Maintenance: Once the desktop application is deployed, enter the maintenance phase. Provide ongoing support, address reported issues or bugs, and incorporate user feedback for future updates. Iterations can be utilized during this phase to introduce enhancements, fix defects, or introduce new features based on user needs. Throughout the development process, it's important to maintain communication with stakeholders, gather feedback, and continuously refine the application. The Waterfall Iterative Model allows for regular iterations to accommodate changes, improvements, and evolving requirements while still maintaining the structure and accountability of the Waterfall Model. TECHNOLOGY USED Front End Technology1. Swing is a set of program component for Java programmers that provide the ability to create graphical user interface ( GUI ) components, such as buttons and scroll bars, that are independent of the windowing system for specific operating system . Swing components are used with the Java Foundation Classes (JFC ). Swing was developed to provide a more sophisticated set of GUI components than the earlier Abstract Window Toolkit (AWT). Swing provides a native look and feel that emulates the look and feel of several platforms, and also supports a pluggable look and feel that allows applications to have a look and feel unrelated to the underlying platform. It has more powerful and flexible components than AWT. In addition to familiar components such as buttons, check boxes and labels, Swing provides several advanced components such as tabbed panel, scroll panes, trees, tables, and lists. 2. AWT-The Abstract Window Toolkit (AWT) is Java's original platform-dependent windowing, graphics, and user-interface widget toolkit preceding Swing. The AWT is part of the Java Foundation Classes (JFC) — the standard API for providing a graphical user interface (GUI) for a Java program. AWT is also the GUI toolkit for a number of Java ME profiles. When Sun Microsystems first released Java in 1995, AWT widgets provided a thin level of abstraction over the underlying native user-interface. For example, creating an AWT check box would cause AWT directly to call the underlying native subroutine that created a check box. However, a check box on Microsoft Windows is not exactly the same as a check box on Mac OS or on the various types of UNIX. Some application developers prefer this model because it provides a high degree of fidelity to the underlying native windowing toolkit and seamless integration with native applications. In other words, a GUI program written using AWT looks like a native Microsoft Windows application when run on Windows, but the same program looks like a native Apple Macintosh application when run on a Mac, etc. However, some application developers dislike this model because they prefer their applications to look exactly the same on every platform. 3. JAVASCRIPT: Highlevel, dynamic, untyped,and interpreted programminglanguage. It has been standardized in the ECMAScript language specification. Alongside HTML and CSS, it is one of the three core technologies of World Wide Web content production; the majority of websites employ it and it is supported by all modern Web browsers without plug-ins. JavaScript is prototype-based with first-class functions, making it a multi-paradigm language, supporting object-oriented, imperative, and functional programming styles. It has an API for working with text, arrays, dates and regular expressions, but does not include any I/O, such as networking, storage, or graphics facilities, relying for these upon the host environment in which it is embedded. JavaScript is also used in environments that are not Web-based, such as PDF documents, site-specific browsers, and desktop widgets. Newer and faster JavaScript virtual machines (VMs) and platforms built upon them have also increased the popularity of JavaScript for server-side Web applications. 4. CSS(Cascading Style Sheet) is a style sheet language used for describing the presentation of a document written in a mark-up language. Although most often used to set the visual style of web pages and user interfaces written in HTML and XHTML, the language can be applied to any XML document, including plain XML, SVG and XUL, and is applicable to rendering in speech, or on other media. Along with HTML and JavaScript, CSS is a cornerstone technology used by most websites to create visually engaging web pages, user interfaces for web applications, and user interfaces for many mobile applications. CSS is designed primarily to enable the separation of document content from document presentation, including aspects such as the layout, colours, and fonts. This separation can improve content accessibility, provide more flexibility and control in the specification of presentation characteristics, enable multiple HTML pages to share formatting by specifying the relevant CSS in a separate .css file, and reduce complexity and repetition in the structural content. Separation of formatting and content makes it possible to present the same markup page in different styles for different rendering methods, such as on-screen, in print, by voice (via speechbased browser or screen reader), and on Braille-based tactile devices. It can also display the web page differently depending on the screen size or viewing device. Readers can also specify a different style sheet, such as a CSS file stored on their own computer, to override the one the author specified. Changes to the graphic design of a document (or hundreds of documents) can be applied quickly and easily, by editing a few lines in the CSS file they use, rather than by changing markup in the documents. The CSS specification describes a priority scheme to determine which style rules apply if more than one rule matches against a particular element. In this so-called cascade, priorities (or weights) are calculated and assigned to rules, so that the results are predictable. 5. Bootstrap is a free and open-source front-end web framework for designing websites and web applications. It contains HTML- and CSS-based design templates for typography, forms, buttons, navigation and other interface components, as well as optional JavaScript extensions. Unlike many web frameworks, it concerns itself with front-end development only. Bootstrap is the second most-starred project on GitHub, with more than 111,600 stars and 51,500 forks. Bootstrap is modular and consists of a series of Less style sheets that implement the various components of the toolkit. These style sheets are generally compiled into a bundle and included in web pages, but individual components can be included or removed. Bootstrap provides a number of configuration variables that control things such as color and padding of various components. Since Bootstrap 2, the Bootstrap documentation has included a customization wizard which generates a customized version of Bootstrap based on the requested components and various settings. As of Bootstrap 4, Sass is used instead of Less for the style sheets. Each Bootstrap component consists of an HTML structure, CSS declarations, and in some cases accompanying JavaScript code. Grid system and responsive design comes standard with an 1170 pixel wide grid layout. Alternatively, the developer can use a variable-width layout. For both cases, the toolkit has four variations to make use of different resolutions and types of devices: mobile phones, portrait and landscape, tablets and PCs with low and high resolution. Each variation adjusts the width of the columns. Bootstrap, originally named Twitter Blueprint, was developed by Mark Otto, Sarvesh Mishra and Jacob Thornton at Twitter as a framework to encourage consistency across internal tools. Back End Technology1. JAVA: The Java programming language is a high-level language that can be characterized by all of the following buzzwords: simple, robust, multithreaded, object oriented, platform independent. In the Java programming language, all source code is first written in plain text files ending with the .java extension. Those source files are then compiled into .class files by the java compiler. A .class file does not contain code that is native to your processor; it instead contains BYTECODES — the machine language of the Java Virtual Machine (Java VM). The java launcher tool then runs your application with an instance of the Java Virtual Machine. Because the Java VM is available on many different operating systems, the same .class files are capable of running on Microsoft Windows, the Solaris™ Operating System (Solaris OS), Linux, or Mac OS. The Java platform has two components: • The Java Virtual Machine • The Java Application Programming Interface (API) 2. MySQL- It is an open-source relational database management system (RDBMS). Its name is a combination of "My", the name of co-founder Michael Widenius' daughter, and "SQL", the abbreviation for Structured Query Language. The MySQL development project has made its source code available under the terms of the GNU General Public License, as well as under a variety of proprietary agreements. MySQL was owned and sponsored by a single for-profit firm, the Swedish company MySQL AB, now owned by Oracle Corporation. For proprietary use, several paid editions are available, and offer additional functionality. MySQL is written in C and C++. Its SQL parser is written in yacc, but it uses a home-brewed lexical analyzer. MySQL works on many system FreeBSD, platforms, HPUX, eComStation, including AIX, i5/OS, IRIX, Linux, BSDi, OSX, Microsoft Windows, NetBSD, NovellNetWare, OpenBSD, OpenSolaris, OS/2 Warp, QNX, OracleSolaris, Symbian,SunOS, SCOOpenServer, SCO UnixWare, Sanos and Tru64. A port of MySQL to OpenVMS also exists. The MySQL server software itself and the client libraries use dual-licensing distribution. They are offered under GPL version 2,beginning from 28 June 2000 (which in 2009 has been extended with a FLOSS License Exception) or to use a proprietary license. CHAPTER 2: SYSTEM ANALYSIS Key points to consider during the analysis phase: 1. Requirements gathering: Start by identifying and documenting the functional and non-functional requirements of the food management system. This includes features such as user registration, menu management, order processing, inventory management, payment integration, and reporting capabilities. 2. Use cases: Define the various actions or interactions that users can perform within the system. For example, a user can place an order, view order history, update menu items, etc. Document these use cases to understand the system's behavior and how different components will interact. 3. Data modeling: Identify the entities and their relationships within the system. For a food management system, you may have entities like customers, orders, menu items, inventory, and payments. Determine the attributes and associations between these entities to create an appropriate data model. 4. System architecture: Define the overall architecture of the system. Decide whether you will follow a layered architecture (e.g., presentation layer, business logic layer, data access layer) or adopt a microservices-based architecture. Consider factors such as scalability, performance, and maintainability when designing the system's architecture. 5. User interfaces: Design intuitive and user-friendly interfaces for different user roles, such as customers, administrators, and kitchen staff. Consider the functionality required for each user role and create wireframes or mockups to visualize the user interfaces. 6. Security considerations: Identify potential security risks and design appropriate security measures. This includes authentication and authorization mechanisms, data encryption, secure communication, and input validation to prevent vulnerabilities like SQL injection or cross-site scripting attacks. 7. Integration requirements: Determine if the system needs to integrate with external services or APIs, such as payment gateways, SMS notifications, or inventory management systems. Identify the necessary integration points and design the interfaces accordingly. 8. Performance and scalability: Analyze the expected system load and design the system to handle it efficiently. Consider factors like concurrent user access, peak load times, and data storage requirements. Optimize database queries, use caching mechanisms, and implement load balancing techniques to ensure the system performs well under different scenarios. Remember that these are just general guidelines, and the specific requirements and scope of your food management system may vary. It's important to have detailed discussions with stakeholders and document all relevant information to ensure a comprehensive system analysis. 2.1: Planning & Requirement Analysis Here's an outline for the 1. planning and requirement analysis Project of the project: Scope: - Clearly define the scope of the food management system. Will it focus on online food ordering, restaurant management, or both? - Determine the target audience, such as customers, restaurant owners, or kitchen staff, and specify their 2. specific Stakeholder requirements. Analysis: - Identify all stakeholders involved in the project, including end users, management, administrators, and any third-party integrations. - Understand their needs, expectations, and any specific constraints they may have. 3. Functional Requirements: - Identify and document the core functionalities of the system. These may include user registration and login, menu management, order placement and tracking, payment processing, inventory management, and reporting capabilities. - Specify any additional features like discounts, promotions, loyalty programs, or table reservation 4. (if applicable). Non-functional Requirements: - Identify the non-functional requirements of the system, such as performance, security, scalability, and usability. - Define acceptable response times, maximum system load, and any specific security measures needed to protect 5. sensitive Use data. Case Analysis: - Define the primary use cases that represent the main interactions within the system. For example, placing an order, managing inventory, generating reports, or processing payments. - Create detailed use case diagrams and descriptions to capture the system's behavior from the user's perspective. 6. Data Analysis: - Identify the main entities in the system, such as customers, orders, menu items, inventory, and - payments. Determine the attributes and relationships between entities. - Design a database schema to store the relevant data and ensure data integrity. 7. User Interface Design: - Design intuitive and user-friendly interfaces for different user roles. Consider wireframing or prototyping tools to visualize the layout and functionality. - Ensure the interfaces are responsive, accessible, and meet the usability requirements of the target audience. 8. System Architecture: - Decide on the system architecture that best suits the project, such as a layered architecture or a microservices-based approach. - Determine the technologies, frameworks, and libraries to be used, such as Java, Spring Boot, Hibernate, or 9. Project - Create a project a specific database Timeline timeline, breaking management and down tasks into system. Resources: manageable units. - Assign resources, including developers, testers, and any external dependencies. - Set milestones and deadlines to ensure timely completion of the project. 10. Risk Assessment: - Identify potential risks and challenges that may arise during the project's development and implementation. - Assess the impact of each risk and devise mitigation strategies to minimize their effect. Remember to involve stakeholders throughout the planning and requirement analysis phase to gather feedback and ensure that the documented requirements align with their expectations. Requirements analysis in systems engineering and software engineering, encompasses those tasks that go into determining the needs or conditions to meet for a new or altered product, taking account of the possibly conflicting requirements of the various analysing, documenting, validating and managing software or system requirements. The first step in system development life cycle is the identification of need of change to improve or enhance an existing system. An initial investigation on existing system was carried out. Many problems were identified during the initial study of the existing system. Features of Project • A fast and more efficient service to all users. As there are thousands of users records; Searching process is an easy task. • Saving in time in entering and manipulating data. • Easy input, deletion and manipulation of user’s details. • Simple correction of input errors and we can assess the input data accurately. • Provides more security and integrity to data. • Easy interaction between restaurants and customers. 2.2: Defining Requirements A preliminary investigation is carried out by the system analyst working under the direction of the committee to evaluate project request. Preliminary investigation is the collecting of information that permits committee members to evaluate the merits of the project request and make informed judgment about feasibility of the proposed system. In preliminary investigation we should accomplish the following objectives: • Clarify and understanding of the project request. • Determine the size of the Project. • Assess costs and benefits of alternative approaches. • Determine the technical and operational feasibility of alternative approaches. • Reports the findings to management, with the recommendation outlining the acceptance or rejection of the project. When the internet was not there it was very difficult for people to order foods nearby their area. The approach was somewhat restricted. But with the advent of internet and creation of online application. The collection of views knew no boundaries. Food Management System sites boast to be better for searching of food options according to the requirement of the customer for their meals. Depending on the results of the initial investigation the survey is now expanded to a more detailed feasibility study. “FEASIBILITY STUDY” is a test of system proposal according to its workability, impact of the organization, ability to meet needs and effective use of the resources. It focuses on these major questions: • What are the user’s demonstrable needs and how does a candidate system meet them? • What resources are available for given customers system? • What are the likely impacts of the users system on the app? • Whether it is worth to solve the problem? During feasibility analysis for this project, following primary areas of interest are to be considered. Investigation and generating ideas about a new system does this. Steps in feasibility analysis:Eight steps involved in the feasibility analysis are: • Form a project team and appoint a project leader. • Prepare system flowcharts. • Enumerate potential proposed system. • Define and identify characteristics of proposed system. • Determine and evaluate performance and cost effective of each proposed system. • Weight system performance and cost data. • Select the best-proposed system. • Prepare and report final project directive to management. • Feasibility study is the process of determination of whether or not a project is worth doing. Feasibility studies are undertaken within tight time constraints and normally culminate in a written and oral feasibility report. The contents and recommendations of this feasibility study helped us as a sound basis for deciding how to precede the project. It helped in taking decisions such as which software to use, hardware combinations, etc. • The following is the process diagram for feasibility analysis. In the diagram, the feasibility analysis starts with the user set of requirements. With this, the existing system is also observed. The next step is to check for the deficiencies in the existing system. By evaluating the above points a fresh idea is conceived to define and quantify the required goals. Besides that, a set of alternatives and their feasibility is also considered in case of any failure in the proposed system. Thus, feasibility study is an important part in software development. • In the SDLC (Systems Development Life Cycle) of our project we maintained a number of feasibility checkpoints between the two phases of the SDLC. • These checkpoints indicate that the management decision to be made after a phase is complete. The feasibility checkpoints in our project were as follows: • Survey phase checkpoint • Study phase checkpoint • Selection phase checkpoint • Acquisition phase checkpoint • Design phase checkpoint Technical feasibility A study of resource availability that may affect the ability to achieve an acceptable system. This evaluation determines whether the technology needed for the proposed system is available or not. • Can the work for the project be done with current equipment existing software technology & available personal? • Can the system be upgraded if developed? • If new technology is needed then what can be developed? This is concerned with specifying equipment and software that will successfully satisfy the user requirement. The technical needs of the system may include: Front-end and back-end selection An important issue for the development of a project is the selection of suitable front-end -and back-end. When we decided to develop the project we went through an extensive study to determine the most suitable platform that suits the needs of the organization as well as helps in development of the project. The aspects of our study included the following factors. Front-end selection • It must have a graphical user interface that assists employees that are not from IT Background. • Scalability and extensibility. • Flexibility. • Robustness. • According to the organization requirement and the culture. • Must provide excellent reporting features with good printing support. Back-end Selection • Multiple user support. • Efficient data handling. • Provide inherent features for security. • Efficient data retrieval and maintenance. • Stored procedures. • Popularity. • Operating System compatible. • Easy to install. Economical feasibility Economic justification is generally the “Bottom Line” consideration for most systems. Economic justification includes a broad range of concerns that includes cost benefit analysis. In this we weight the cost and the benefits associated with the candidate system and if it suits the basic purpose of the organization i.e. profit making, the project is making to the analysis and design phase. The financial and the economic questions during the preliminary investigation are verified to estimate the following: • The cost to conduct a full system investigation. • The cost of hardware and software for the class of application being considered. • The benefits in the form of reduced cost. • The proposed system will give the minute information, as a result the performance is improved which in turn may be expected to provide increased profits. • This feasibility checks whether the system can be developed with the available funds. This System does not require enormous amount of money to be developed. This can be done economically if planned judicially, so it is economically feasible. Economic analysis is the most frequently used method for evaluating the effectiveness of the candidate system. More commonly known as cost/benefit analysis, the procedure is to be determining the benefits and savings that are expected from a candidate and compare them with costs. If benefits outweigh costs, then the decision is made to design and implement the system. A systems financial benefit must exceed the cost of developing that system. i.e. a new system being developed should be a good investment for the organization. Economic feasibility considers the following: • The cost to conduct a full system investigation. • The cost of hardware and software for the class of application. • The benefits in the form of reduced cost or fewer costly errors. • The cost if nothing changes (i.e. the proposed system is not developed). The proposed Web Portal For Fast Food Management System is economically feasible because • The system requires very less time factors. • The system will provide fast and efficient automated environment instead of slow and error prone manual system, thus reducing both time and man power spent in running the system. • The system will have GUI interface and very less user-training is required to learn it. • The system will provide service to view various information for proper managerial decision making. Operational Feasibility It is mainly related to human organizations and political aspects. The points to be considered are: • What changes will be brought with the system? • What organization structures are disturbed? • What new skills will be required? Do the existing staff members have these skills? If not, can they be trained in due course of time? The system is operationally feasible as it very easy for the End users to operate it. It only needs basic information about Windows platform. Time evaluation is the most important consideration in the development of project. The time schedule required for the developed of this project is very important since more development time effect machine time, cost and cause delay in the development of other systems. • It seems that management of the company is very much interested in the new system. The management & the users are normally the same members so there is no problem of conflict between the management & users. • Since all work is going manually that’s why there is no linking with old system reflects. • The user & management both are ready to accept the new system, so they both show keen interest in giving the facts. Schedule feasibility Time evaluation is the most important consideration in the development of project. The time schedule required for the developed of this project is very important since more development time effect machine time, cost and cause delay in the development of other systems. A reliable Inn Management system can be developed in the considerable amount of time. Software & Hardware Requirements In our proposed system “Fast Food Management System” we are using following tools and Technology on Windows 10 Platform: Front End : HTML, CSS, JavaScript, Bootstrap, Swing, Java Backend : MySQL Operating System : Windows 10 Tools : NetBeans, Notepad, MySQL Query Browser Web Servers : XAMPP Browser Program : Internet explorer/Mozilla Firefox/Google Chrome Requirements for a Java project on a fast-food management system: 1. User Management: - The system should allow customers to register, login, and manage their profiles. - Customers should be able to view and update their personal information, including contact details and delivery addresses. 2. Menu Management: - The system should provide an interface for administrators to add, edit, and remove menu items. - Each menu item should have details such as name, description, price, and ingredients. - Administrators should be able to categorize menu items (e.g., burgers, pizzas, beverages) for easy navigation. 3. Ordering and Payment: - Customers should be able to browse the menu, select items, and add them to their cart. - The system should calculate the total order amount, including taxes and any additional charges. - Customers should have the option to choose different payment methods (e.g., credit card, cash on delivery). - Upon successful payment, the system should generate an order confirmation with a unique order ID. 4. Order Processing and Tracking: - The system should notify the kitchen staff about incoming orders in real-time. - Kitchen staff should be able to update the order status (e.g., preparing, cooking, ready for delivery). - Customers should be able to track the status of their orders and receive updates via email or SMS. 5. Inventory Management: - The system should keep track of available ingredients and their quantities. - When an order is placed, the system should automatically update the inventory to reflect the used ingredients. - Administrators should be able to view the current stock levels and receive alerts when inventory is running low. 6. Reporting and Analytics: - The system should provide various reports, such as sales reports, popular menu items, and customer feedback. - Administrators should be able to generate reports based on specific time periods and filter criteria. - The system should offer graphical representations of data for better visualization and analysis. 7. Security: - User passwords should be securely stored using hashing and salting techniques. - The system should protect sensitive customer information and adhere to data protection regulations. - Access to sensitive features (e.g., menu management, user management) should be restricted to authorized administrators. 8. Integration: - The system should integrate with a payment gateway to securely process online payments. - It may integrate with third-party delivery services to automate order dispatch and tracking. Remember, these are just example requirements. You should tailor them to meet the specific needs and scope of your fast food management system project. 2.2: SRS Software requirements specification establishes the basis for an agreement between customers and contractors or suppliers (in market-driven projects, these roles may be played by the marketing and development divisions) on what the software product is to do as well as what it is not expected to do. Software requirements specification permits a rigorous assessment of requirements before design can begin and reduces later redesign. It should also provide a realistic basis for estimating product costs, risks, and schedules.[1] Software requirements specification prevents software projects from failure. The software requirements specification document enlists enough and necessary requirements that are required for the project development. To derive the requirements we need to have clear and thorough understanding of the products to be developed or being developed. The SRS may be one of a contract deliverable Data Item Descriptions or have other forms of organizationally-mandated content. A typical functional requirement will contain a unique name and number, a brief summary, and a rationale. This information is used to help the reader understand why the requirement is needed, and to track the requirement through the development of the system. The crux of the requirement is the description of the required behaviour, which must be clear and readable. The described behaviour may come from organizational or business rules, or it may be discovered through elicitation sessions with users, stakeholders, and other experts within the organization. Many requirements may be uncovered during the use case development. When this happens, the requirements analyst may create a placeholder requirement with a name and summary, and research the details later, to be filled in when they are better known. Functional requirements In Software engineering and systems engineering, a functional requirement defines a function of a system or its component. A function is described as a set of inputs, the behaviour, and outputs. Functional requirements may be calculations, technical details, data manipulation and processing and other specific functionality that define what a system is supposed to accomplish. Behavioural requirements describing all the cases where the system uses the functional requirements are captured in use cases. Functional requirements are supported by non-functional requirements (also known as quality requirements), which impose constraints on the design or implementation (such as performance requirements, security, or reliability). Generally, functional requirements are expressed in the form "system must do <requirement>", while non-functional requirements are "system shall be <requirement>". The plan for implementing functional requirements is detailed in the system design. The plan for implementing non-functional requirements is detailed in the system architecture. As defined in requirements engineering, functional requirements specify particular results of a system. This should be contrasted with non-functional requirements which specify overall characteristics such as cost and reliability. Functional requirements drive the application architecture of a system, while non-functional requirements drive the technical architecture of a system. In some cases a requirements analyst generates use cases after gathering and validating a set of functional requirements. The hierarchy of functional requirements is: user/stakeholder request → feature → use case → business rule. Each use case illustrates behavioural scenarios through one or more functional requirements. Often, though, an analyst will begin by eliciting a set of use cases, from which the analyst can derive the functional requirements that must be implemented to allow a user to perform each use case. Non-Functional requirements In systems engineering and requirements engineering, a non-functional requirement is a requirement that specifies criteria that can be used to judge the operation of a system, rather than specific behaviours. They are contrasted with functional requirements that define specific behaviour or functions. The plan for implementing functional requirements is detailed in the system design. The plan for implementing non-functional requirements is detailed in the system architecture, because they are usually Architecturally Significant Requirements. Broadly, functional requirements define what a system is supposed to do and non-functional requirements define how a system is supposed to be. Functional requirements are usually in the form of "system shall do <requirement>", an individual action of part of the system, perhaps explicitly in the sense of a mathematical function, a black box description input, output, process and control functional model or IPO Model. In contrast, non-functional requirements are in the form of "system shall be <requirement>", an overall property of the system as a whole or of a particular aspect and not a specific function. The system's overall properties commonly mark the difference between whether the development project has succeeded or failed. Non-functional requirements are often called "quality attributes" of a system. Other terms for non-functional requirements are "qualities", "quality goals", "quality of service requirements", "constraints" and "non-behavioural requirements".[2] Informally these are sometimes called the "ileitis", from attributes like stability and portability. Qualities—that is non-functional requirements—can be divided into two main categories: Execution qualities, such as security and usability, which are observable at run time. Evolution qualities, such as testability, maintainability, extensibility and scalability, which are embodied in the static structure of the software system. Software Requirements Specification (SRS) outline for a Java project on a Food Management System: 1. Introduction 1.1 Purpose 1.2 Scope 1.3 Document Conventions 1.4 Intended Audience 1.5 References 2. Overall Description 2.1 Product Perspective 2.2 Product Features 2.3 User Classes and Characteristics 2.4 Operating Environment 2.5 Design and Implementation Constraints 2.6 Assumptions and Dependencies 3. Specific Requirements 3.1 External Interface Requirements 3.1.1 User Interfaces 3.1.2 Hardware Interfaces 3.1.3 Software Interfaces 3.1.4 Communication Interfaces 3.2 Functional Requirements 3.2.1 User Management 3.2.2 Menu Management 3.2.3 Ordering and Payment 3.2.4 Order Processing and Tracking 3.2.5 Inventory Management 3.2.6 Reporting and Analytics 3.2.7 Security 3.2.8 Integration Requirements 3.3 Non-functional Requirements 3.3.1 Performance 3.3.2 Security 3.3.3 Usability 3.3.4 Reliability 3.3.5 Scalability 3.3.6 Maintainability 4. System Models 4.1 Use Case Diagrams 4.2 Class Diagrams 4.3 Sequence Diagrams 5. Appendices 5.1 Glossary 5.2 User Profiles 5.3 Data Dictionary 5.4 Constraints This is a high-level outline, and each section should be expanded to include detailed information specific to your food management system project. Include functional and nonfunctional requirements, use case diagrams, class diagrams, sequence diagrams, and any additional diagrams or models that help illustrate the system's behavior and structure. Explaining each & every point of SRS on FAST FOOD MANAGEMENT SYSTEM Java Project: 1. Introduction: - Purpose: Describe the purpose of the SRS, which is to provide a comprehensive understanding of the requirements for the Food Management System. - Scope: Specify the boundaries and limitations of the system, such as the functionalities and features it will include. - Document Conventions: Explain any specific conventions or standards used in the document, such as naming conventions or notation formats. - Intended Audience: Identify the stakeholders and readers of the SRS, such as developers, testers, project managers, or clients. - References: Provide a list of any external sources or documents that were used as references during the requirements gathering process. 2. Overall Description: - Product Perspective: Explain how the Food Management System fits into the larger context, including any existing systems it may interface with or dependencies it has. - Product Features: Provide an overview of the key features and functionalities of the system, such as user management, menu management, ordering and payment, etc. - User Classes and Characteristics: Describe the different types of users who will interact with the system and their characteristics, such as customers, administrators, or kitchen staff. - Operating Environment: Specify the hardware and software environment in which the system will operate, including any specific operating systems, databases, or web servers required. - Design and Implementation Constraints: Outline any constraints that may impact the system's design or implementation, such as time constraints, budget limitations, or specific technology requirements. - Assumptions and Dependencies: State any assumptions made during the requirements gathering process and list any external systems or components the Food Management System depends on. 3. Specific Requirements: - External Interface Requirements: Describe the interfaces between the system and external entities, such as user interfaces, hardware interfaces, software interfaces, and communication interfaces. - Functional Requirements: Detail the functional capabilities of the system, including user management, menu management, ordering and payment, order processing and tracking, inventory management, reporting and analytics, security, and integration requirements. - Non-functional Requirements: Specify the non-functional aspects of the system, such as performance, security, usability, reliability, scalability, and maintainability. Include specific metrics or criteria against which these requirements will be evaluated. 4. System Models: - Use Case Diagrams: Present a graphical representation of the system's interactions with different users or actors, showcasing the main use cases and their relationships. - Class Diagrams: Illustrate the classes, their attributes, and their relationships within the system to provide a high-level view of the system's structure. - Sequence Diagrams: Show the sequence of interactions between objects or components during specific use cases, demonstrating the flow of events and message exchanges. 5. Appendices: - Glossary: Include a list of technical terms, abbreviations, and acronyms used in the SRS to ensure a shared understanding of terminology. - User Profiles: Provide detailed descriptions of different user roles, their responsibilities, and their specific interactions with the system. - Data Dictionary: Define the entities, attributes, and relationships in the system's data model, including any constraints or rules. - Constraints: Document any additional constraints or limitations that were not covered in the earlier sections. The content and structure of an SRS can vary depending on the specific project requirements and organizational preferences. It's important to tailor the document to accurately reflect the needs and expectations of the Food Management System project. Regular collaboration and communication with stakeholders will help ensure that the SRS effectively captures and communicates the requirements. 2.3: PERT CHART A PERT chart is a project management tool that helps visualize the tasks, dependencies, and timeline of a project. Here's a step-by-step guide to creating a PERT chart for a food management system: 1. Identify Tasks: Make a list of all the major tasks required to develop the food management system. These tasks could include requirements gathering, system design, database setup, user interface development, menu management, order processing, payment integration, testing, and deployment. 2. Determine Task Dependencies: Determine the dependencies between tasks. Some tasks can be worked on concurrently, while others may require completion of specific tasks before they can start. Identify the predecessor-successor relationships between tasks to establish dependencies. 3. Estimate Durations: Estimate the time required to complete each task. This estimation can be done in terms of days, weeks, or any other unit of time that suits your project. Consider factors such as task complexity, available resources, and any potential risks or dependencies. 4. Create PERT Nodes: Create nodes or circles on a chart for each task, labeling them with the task name and estimated duration. Place these nodes in a logical sequence based on their dependencies. 5. Connect the Nodes: Use arrows or lines to connect the nodes, representing the dependencies between tasks. Draw arrows from the predecessor tasks to the successor tasks. 6. Determine Critical Path: Identify the critical path, which is the longest sequence of dependent tasks that determines the project's overall duration. The critical path shows which tasks must be completed on time to prevent project delays. 7. Assign Resources: Consider the resources required for each task, such as developers, testers, or designers. You can assign these resources to specific tasks on the PERT chart to visualize resource allocation and potential bottlenecks. 8. Review and Refine: Review the PERT chart, validate the dependencies and durations with your project team, and make any necessary adjustments or refinements. This collaborative review ensures the accuracy and completeness of the chart. 2.4: Literature Survey A literature survey for a Java project typically involves researching existing literature, articles, and publications related to the specific domain or topic of the project. Here are some key points to consider when conducting a literature survey for a Java project: 1. Research Objectives: Define the specific objectives of your Java project to narrow down your literature search. Identify the main topics, technologies, or challenges that are relevant to your project. 2. Relevant Research Databases: Explore relevant research databases, such as IEEE Xplore, ACM Digital Library, Google Scholar, or other domain-specific databases, to find scholarly articles and research papers related to your project's topic. 3. Keywords and Search Terms: Develop a list of keywords and search terms that are specific to your project. Use these terms to search for literature and refine your search results. Consider including terms like "Java programming," "Java frameworks," or specific libraries or technologies related to your project. 4. Books and Textbooks: Consult books and textbooks related to Java programming and the specific domain of your project. These resources can provide a comprehensive understanding of Java concepts, design patterns, and best practices. 5. Academic Papers and Journals: Look for academic papers and journal articles that focus on Java development, software engineering, or specific areas related to your project. These papers may provide insights into algorithm optimization, performance tuning, or design patterns for Java projects. 6. Conference Proceedings: Review conference proceedings in the field of software engineering, Java programming, or relevant domains. Conference papers often present innovative approaches, tools, and case studies that can be valuable for your project. 7. Online Resources and Tutorials: Explore online resources such as developer blogs, forums, and tutorials related to Java development. These resources can provide practical examples, code snippets, and discussions on specific Java-related topics. 8. Open Source Projects: Investigate open-source projects and libraries related to your project. Analyze their source code, documentation, and community discussions to understand best practices, coding conventions, and potential solutions to similar problems. 9. Comparative Analysis: Look for studies or articles that compare different Java frameworks, libraries, or tools. These comparative analyses can help you evaluate the pros and cons of different options and make informed decisions for your project. 10. Stay Updated with Recent Research: Pay attention to recent publications and stay updated with the latest research and advancements in the field of Java development. This can help you incorporate the latest techniques, technologies, or best practices into your project. A literature survey on food management systems typically involves conducting a comprehensive review of existing research, articles, and publications related to the topic. Here are some key points to consider when conducting a literature survey on food management systems: 1. Research Databases: Start by exploring relevant research databases such as IEEE Xplore, ACM Digital Library, Google Scholar, or other academic databases. Use appropriate keywords such as "food management system," "restaurant management software," or "food ordering system" to narrow down your search. 2. Key Topics: Identify the key topics related to food management systems that you want to explore in your literature survey. These may include user interfaces, menu management, order processing, inventory management, payment integration, data analytics, or security. 3. Research Papers and Articles: Look for peer-reviewed research papers, conference papers, and journal articles that focus on food management systems. Pay attention to recent publications to ensure you have the most up-to-date information. 4. Case Studies and Industry Reports: Explore case studies and industry reports that provide insights into real-world implementations of food management systems. These can provide practical examples, best practices, and challenges faced in the field. 5. Comparative Analysis: Analyze and compare different food management systems and their features. Look for studies that evaluate the performance, usability, and effectiveness of various systems. This can help identify the strengths and weaknesses of different approaches. 6. Emerging Technologies: Investigate how emerging technologies, such as artificial intelligence, machine learning, Internet of Things (IoT), or blockchain, are being utilized in food management systems. Explore the potential benefits and challenges associated with these technologies in the context of the food industry. 7. User Experience and Human-Computer Interaction: Consider research that focuses on user experience (UX) and human-computer interaction (HCI) in the context of food management systems. Understand how the system design and interface impact user satisfaction, efficiency, and ease of use. 8. Security and Privacy: Look for studies that address security and privacy concerns in food management systems. Explore approaches to secure customer data, protect transactions, and ensure compliance with data protection regulations. 9. Future Trends and Challenges: Identify research or opinion papers that discuss future trends and challenges in the field of food management systems. This can help you gain insights into the evolving landscape and potential areas for further research. 10. Synthesize Findings: Organize and synthesize the information gathered from the literature survey. Identify common themes, trends, and gaps in the existing literature. This synthesis will form the basis for your understanding of the current state of food management systems and can help inform your project or research. CHAPTER 3: SYSTEM DESIGN Systems design is the process of defining the architecture, components, modules, interfaces, and data for a system to satisfy specified requirements. Systems design could be seen as the application of systems theory to product development. There is some overlap with the disciplines of systems analysis, systems architecture and systems engineering. Overview • If the broader topic of product development "blends the perspective of marketing, design, and manufacturing into a single approach to product development," then design is the act of taking the marketing information and creating the design of the product to be manufactured. • Systems design is therefore the process of defining and developing systems to satisfy specified requirements of the user. • In the 1990s, standardization of hardware and software resulted in the ability to build modular systems. The increasing importance of software running on generic platforms has enhanced the discipline of software engineering. • Object-oriented analysis and design methods are becoming the most widely used methods for computer systems design. Architectural design The architectural design of a system emphasizes the design of the systems architecture that describes the structure, behaviour and more views of that system and analysis. Logical design The logical design of a system pertains to an abstract representation of the data flows, inputs and outputs of the system. This is often conducted via modelling, using an over-abstract (and sometimes graphical) model of the actual system. In the context of systems, designs are included. Logical design includes entity-relationship diagrams (ER diagrams). Physical design The physical design relates to the actual input and output processes of the system. This is explained in terms of how data is input into a system, how it is verified/ authenticated, how it is processed, and how it is displayed. In physical design, the following requirements about the system are decided. • Input requirements • Output requirements • Storage requirements • Processing requirements • System control and backup or recovery Put another way, the physical portion of systems design can generally be broken down into three sub-tasks: • User Interface Design • Data Design • Process Design User Interface Design is concerned with how users add information to the system and with how the system presents information back to them. Data Design is concerned with how the data is represented and stored within the system. Finally, Process Design is concerned with how data moves through the system, and with how and where it is validated, secured and/or transformed as it flows into, through and out of the system. At the end of the systems design phase, documentation describing the three sub-tasks is produced and made available for use in the next phase. Physical design, in this context, does not refer to the tangible physical design of an information system. To use an analogy, a personal computer's physical design involves input via a keyboard, processing within the CPU, and output via a monitor, printer, etc. It would not concern the actual layout of the tangible hardware, which for a PC would be a monitor, CPU, motherboard, hard drive, modems, video/graphics cards, USB slots, etc. It involves a detailed design of a user and a product database structure processor and a control processor. The H/S personal specification is developed for the proposed system. Approaches of System Design • Top-down approach • Bottom-up approach Top-Down Approach We know that a system is composed of more than one sub-systems and it contains a number of components. Further, these sub-systems and components may have their on set of sub-system and components and creates hierarchical structure in the system. Top-down design takes the whole software system as one entity and then decomposes it to achieve more than one sub-system or component based on some characteristics. Each subsystem or component is then treated as a system and decomposed further. This process keeps on running until the lowest level of system in the top-down hierarchy is achieved. Top-down design starts with a generalized model of system and keeps on defining the more specific part of it. When all components are composed the whole system comes into existence. Top-down design is more suitable when the software solution needs to be designed from scratch and specific details are unknown. Bottom-Up Approach The bottom up design model starts with most specific and basic components. It proceeds with composing higher level of components by using basic or lower level components. It keeps creating higher level components until the desired system is not evolved as one single component. With each higher level, the amount of abstraction is increased. Bottom-up strategy is more suitable when a system needs to be created from some existing system, where the basic primitives can be used in the newer system. Both, top-down and bottom-up approaches are not practical individually. Instead, a good combination of both is used. System design is an essential phase in project development that involves creating a blueprint or architectural plan for the software system. It focuses on defining the structure, components, and interactions of the system. Here are some key steps involved in the system design process: 1. Requirements Analysis: Review the project requirements and understand the needs of stakeholders. Identify the functional and non-functional requirements that the system must fulfill. 2. System Architecture: Define the high-level system architecture, including the overall structure, modules, and their relationships. Consider architectural patterns like layered architecture, client-server architecture, or microservices architecture, based on the project's requirements. 3. Component Design: Decompose the system into smaller components or modules. Identify the responsibilities and functionalities of each component. Determine how these components will interact and communicate with each other. 4. Database Design: If the system involves data storage, design the database schema and define the tables, relationships, and constraints. Select an appropriate database management system (DBMS) and consider factors like data integrity, scalability, and performance. 5. User Interface Design: Design the user interface (UI) of the system, considering usability, user experience, and accessibility. Create wireframes or prototypes to visualize the layout, navigation, and interactions of the system's screens or pages. 6. System Integration: Plan how different components, modules, or services will integrate and interact with each other. Define the communication protocols, APIs, or message formats for inter-component communication. 7. Data Flow and Processing: Identify the flow of data within the system. Determine how data will be collected, processed, and stored. Design algorithms, workflows, or business logic to handle data transformations and operations. 8. Security and Error Handling: Consider security aspects such as authentication, authorization, and data protection. Define error handling mechanisms, including exception handling, logging, and recovery strategies. 9. Performance and Scalability: Evaluate the performance requirements of the system and design it to handle the expected workload. Consider techniques like caching, load balancing, and optimization to ensure scalability and responsiveness. 10. Documentation: Document the system design, including architectural diagrams, component diagrams, database schema, and user interface mockups. This documentation serves as a reference for developers, stakeholders, and future maintenance. It's important to note that system design is an iterative process, and it may involve multiple iterations and refinements based on feedback, constraints, or evolving requirements. Collaboration with the development team, stakeholders, and subject matter experts is crucial to ensure a well-designed and robust system. DATABASE DESIGN Database design is the process of producing a detailed data model of database. This data model contains all the needed logical and physical design choices and physical storage parameters needed to generate a design in a data definition language, which can then be used to create a database. A fully attributed data model contains detailed attributes for each entity. The term database design can be used to describe many different parts of the design of an overall database system. Principally, and most correctly, it can be thought of as the logical design of the base data structures used to store the data. In the relational model these are the tables and views. In an object database the entities and relationships map directly to object classes and named relationships. However, the term database design could also be used to apply to the overall process of designing, not just the base data structures, but also the forms and queries used as part of the overall database application within the database management system (DBMS). The process of doing database design generally consists of a number of steps which will be carried out by the database designer. Usually, the designer must: • Determine the data to be stored in the database. • Determine the relationships between the different data elements. • Superimpose a logical structure upon the data on the basis of these relationships. Within the relational model the final step above can generally be broken down into two further steps that of determining the grouping of information within the system, generally determining what are the basic objects about which information is being stored, and then determining the relationships between these groups of information, or objects. This step is not necessary with an Object database. CONCEPTUAL DESIGN Zero Level DFD Data flow diagram (DFD) represents the flows of data between different processes in a business. It is a graphical technique that depicts information flow and the transforms that are applied as data move form input to output. It provides a simple, intuitive method for describing business processes without focusing on the details of computer systems. DFDs are attractive technique because they provide what users do rather than what computers do.The DFD may be used for any level of data abstraction. DFD can be partitioned into levels. Each level has more information flow and data functional details than the previous level. • Highest level is Context Diagram. Some important points are: • 1 bubble (process) represents the entire system. • Data arrows show input and output. • Data Stores NOT shown. They are within the system. A DFD may look similar to a flow chart. However, there is a significant difference with the data flow diagram. The arrows in DFDs show that there is a flow of data between the two components and not that the component is sending the data that must be executed in the following component. Rules • In DFDs, all arrows must be labeled. • The information flow continuity, that is all the input and the output to each refinement, must maintain the same in order to be able to produce a consistent system. • Modification to a data layout in DFDs may cause the entire layout to be changed. This is because the specific changed data will bring different data to units that it accesses. Therefore, evaluation of the possible of the effect of the modification must be considered first. • The number of units in a DFD in a large application is high. Therefore, maintenance is harder, more costly and error prone. This is because the ability to access the data is passed explicitly from one component to the other. This is why changes are impractical to be made on DFDs especially in large system. The context diagram provides an overview of the system, showing the interactions between the system and external entities. In this case, the system is the Food Ordering System, and the external entities are the Customer and the Kitchen. ``` +------------------------+ | Food Ordering | System | | +------------+-----------+ | | v +----------+ | Customer | +----------+ | | v +------+ |Kitchen| +------+ ``` Level 1 DFD: The level 1 DFD expands on the context diagram by decomposing the system into more detailed processes or functions. Here's an example of a level 1 DFD for the Food Ordering System: +--------------------------+ | Food Ordering | System | | +------------+-------------+ | | Order Food v +-----+ |User | +-----+ | | Place Order v +--------------+ |Order | |Processing | +--------------+ | | Send Order v +--------------+ | Kitchen | | Staff | +--------------+ | | Prepare Food v +--------------+ | Kitchen | | Operations | +--------------+ | | Deliver Food v +--------------+ | Delivery | | Personnel | +--------------+ This level 1 DFD illustrates the main processes involved in the Food Ordering System, including User Interaction, Order Processing, Kitchen Operations, and Delivery. Each process represents a distinct function or set of activities within the system. Level 2 DFD In this Level 2 DFD, each process from the Level 1 DFD is further decomposed into more detailed sub-processes. Here's a brief description of each process: 1. Customer Interface: Handles the interaction between the user (customer) and the system, such as placing an order, updating order details, or cancelling an order. 2. Order Management: Manages the order-related activities, including order processing, updating order status, and generating invoices. 3. Inventory Management: Tracks and manages the inventory of food items, including stock updates, checking availability, and generating alerts for low stock. 4. Kitchen Operations: Handles the tasks related to the kitchen operations, such as receiving and processing orders, assigning orders to kitchen staff, and updating order status. 5. Kitchen Staff: Performs the actual food preparation tasks based on the order details, including cooking, assembling, and packaging the food items. 6. Delivery Personnel: Manages the delivery process, including assigning delivery personnel, updating delivery status, and generating delivery reports. Each process in the Level 2 DFD represents a specific function or set of activities within the Food Management System. The data flows between the processes indicate the flow of information or data within the system. ``` +--------------------------+ | Food Management System | +------------+-------------+ | | User Interaction v +----------------+ | Customer | | Interface | +----------------+ | | Place Order v +----------------+ | Order | | Management | +----------------+ | | Process Order v +----------------+ | Inventory | | Management | +----------------+ | | Update Inventory v +----------------+ | Kitchen | | Operations | +----------------+ | | Prepare Food v +----------------+ | Kitchen | Staff | | +----------------+ | | Deliver Food v +----------------+ | Delivery | | Personnel | +----------------+ ``` ER Diagram An entity relationship diagram is a means of visualizing how the information a system produces is related. There are five main components of an ERD: • Entities, which are represented by rectangles. An entity is an object or concept about which you want to store information. A weak entity is an entity that must defined by a foreign key relationship with another entity as it cannot be uniquely identified by its own attributes alone. • Actions, which are represented by diamond shapes, show how two entities share information in the database. In some cases, entities can be self-linked. • Attributes, which are represented by ovals. A key attribute is the unique, distinguishing characteristic of the entity. For example, an employee's social security number might be the employee's key attribute. A multivalued attribute can have more than one value. For example, an employee entity can have multiple skill values. A derived attribute is based on another attribute. For example, an employee's monthly salary is based on the employee's annual salary. • Connecting lines, solid lines that connect attributes to show the relationships of entities in the diagram. • Cardinality specifies how many instances of an entity relate to one instance of another entity. Ordinality is also closely linked to cardinality. While cardinality specifies the occurrences of a relationship, ordinality describes the relationship as either mandatory or optional. CHAPTER 4: CODING 4.1 Oracle Coding import java.sql.Connection; import java.sql.DriverManager; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; public class FoodManagementSystem { public static void main(String[] args) { Connection connection = null; Statement statement = null; ResultSet resultSet = null; try { // Step 1: Register the Oracle JDBC driver Class.forName("oracle.jdbc.driver.OracleDriver"); // Step 2: Establish a connection to the Oracle database String url = "jdbc:oracle:thin:@localhost:1521:XE"; // Replace with your Oracle database URL String username = "your_username"; // Replace with your Oracle database username String password = "your_password"; // Replace with your Oracle database password connection = DriverManager.getConnection(url, username, password); // Step 3: Execute SQL queries or database operations statement = connection.createStatement(); String query = "SELECT * FROM food_items"; // Replace with your table name resultSet = statement.executeQuery(query); // Step 4: Process the query results while (resultSet.next()) { String itemName = resultSet.getString("item_name"); // Replace with your column names double price = resultSet.getDouble("price"); System.out.println("Item Name: " + itemName + ", Price: " + price); } } catch (ClassNotFoundException | SQLException e) { e.printStackTrace(); } finally { // Step 5: Close the resources try { if (resultSet != null) { resultSet.close(); } if (statement != null) { statement.close(); } if (connection != null) { connection.close(); } } catch (SQLException e) { e.printStackTrace(); } } } } 4.2 Complete Project Coding 1. SignUp Request Form: /* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package starting; /** * * @author PC */ public class SignupRequestForm extends javax.swing.JFrame { String type; /** * Creates new form SignupRequestForm */ public SignupRequestForm() { initComponents(); this.setLocationRelativeTo(null); //center form in screen } public void openSignUpForm() { SignUpForm signup = new SignUpForm(type); signup.setVisible(true); this.dispose(); } /** * This method is called from within the constructor to initialize the form. * WARNING: Do NOT modify this code. The content of this method is always * regenerated by the Form Editor. */ @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated BEGIN:initComponents private void initComponents() { jPanel1 = new javax.swing.JPanel(); btnManagerLSignupReq = new javax.swing.JButton(); lblManagerLogin = new javax.swing.JLabel(); btnCustomerSignupReq = new javax.swing.JButton(); lblCustomerLogin = new javax.swing.JLabel(); jSeparator1 = new javax.swing.JSeparator(); jSeparator2 = new javax.swing.JSeparator(); jPanel2 = new javax.swing.JPanel(); lbLogo = new javax.swing.JLabel(); jSeparator3 = new javax.swing.JSeparator(); lblCustomerLogin1 = new javax.swing.JLabel(); btnKiitchenSignupReq1 = new javax.swing.JButton(); setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); setUndecorated(true); jPanel1.setBackground(new java.awt.Color(255, 255, 255)); Code">//GEN- btnManagerLSignupReq.setFont(new java.awt.Font("Rockwell Condensed", 1, 28)); // NOI18N btnManagerLSignupReq.setText("Manager Sign Up"); btnManagerLSignupReq.setBorderPainted(false); btnManagerLSignupReq.setContentAreaFilled(false); btnManagerLSignupReq.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR)); btnManagerLSignupReq.setName(""); // NOI18N btnManagerLSignupReq.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnManagerLSignupReqActionPerformed(evt); } }); lblManagerLogin.setFont(new java.awt.Font("Rockwell", 0, 18)); // NOI18N lblManagerLogin.setText("Find everything you need"); btnCustomerSignupReq.setBackground(new java.awt.Color(255, 213, 0)); btnCustomerSignupReq.setFont(new java.awt.Font("Rockwell Condensed", 1, 28)); // NOI18N btnCustomerSignupReq.setText("Customer Sign Up"); btnCustomerSignupReq.setBorderPainted(false); btnCustomerSignupReq.setContentAreaFilled(false); btnCustomerSignupReq.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR)); btnCustomerSignupReq.setName(""); // NOI18N btnCustomerSignupReq.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnCustomerSignupReqActionPerformed(evt); } }); lblCustomerLogin.setFont(new java.awt.Font("Rockwell", 0, 18)); // NOI18N lblCustomerLogin.setText("Find everything you need"); jPanel2.setBackground(new java.awt.Color(255, 213, 0)); lbLogo.setBackground(new java.awt.Color(255, 255, 255)); lbLogo.setFont(new java.awt.Font("Rockwell Condensed", 0, 55)); // NOI18N lbLogo.setForeground(new java.awt.Color(127, 72, 101)); lbLogo.setText("GUSTO"); lbLogo.setToolTipText(""); javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2); jPanel2.setLayout(jPanel2Layout); jPanel2Layout.setHorizontalGroup( jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel2Layout.createSequentialGroup() .addGap(264, 264, 264) .addComponent(lbLogo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) ); jPanel2Layout.setVerticalGroup( jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) 284, .addGroup(jPanel2Layout.createSequentialGroup() .addContainerGap() .addComponent(lbLogo) .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) ); lblCustomerLogin1.setFont(new java.awt.Font("Rockwell", 0, 18)); // NOI18N lblCustomerLogin1.setText("Find everything you need related to kitchen staff"); btnKiitchenSignupReq1.setBackground(new java.awt.Color(255, 213, 0)); btnKiitchenSignupReq1.setFont(new java.awt.Font("Rockwell Condensed", 1, 28)); // NOI18N btnKiitchenSignupReq1.setText("Kitchen Sign Up"); btnKiitchenSignupReq1.setBorderPainted(false); btnKiitchenSignupReq1.setContentAreaFilled(false); btnKiitchenSignupReq1.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR)); btnKiitchenSignupReq1.setName(""); // NOI18N btnKiitchenSignupReq1.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnKiitchenSignupReq1ActionPerformed(evt); } }); javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1); jPanel1.setLayout(jPanel1Layout); jPanel1Layout.setHorizontalGroup( jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel1Layout.createSequentialGroup() .addGap(25, 25, 25) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) .addComponent(lblManagerLogin, javax.swing.GroupLayout.DEFAULT_SIZE, 232, Short.MAX_VALUE) .addComponent(jSeparator2)) .addGap(76, 76, 76) .addComponent(lblCustomerLogin, javax.swing.GroupLayout.PREFERRED_SIZE, 255, javax.swing.GroupLayout.PREFERRED_SIZE) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel1Layout.createSequentialGroup() .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jSeparator1, javax.swing.GroupLayout.PREFERRED_SIZE, 274, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(65, 65, 65)) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup() .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(lblCustomerLogin1, javax.swing.GroupLayout.PREFERRED_SIZE, 362, javax.swing.GroupLayout.PREFERRED_SIZE) .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))) .addComponent(jPanel2, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addGroup(jPanel1Layout.createSequentialGroup() .addComponent(btnManagerLSignupReq, javax.swing.GroupLayout.PREFERRED_SIZE, 281, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(18, 18, 18) .addComponent(btnCustomerSignupReq, javax.swing.GroupLayout.PREFERRED_SIZE, 305, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 71, Short.MAX_VALUE) .addComponent(btnKiitchenSignupReq1, javax.swing.GroupLayout.PREFERRED_SIZE, 305, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(45, 45, 45)) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup() .addContainerGap(326, Short.MAX_VALUE) .addComponent(jSeparator3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(444, 444, 444))) ); jPanel1Layout.setVerticalGroup( jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel1Layout.createSequentialGroup() 255, .addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(18, 18, 18) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(btnManagerLSignupReq, javax.swing.GroupLayout.PREFERRED_SIZE, 59, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(btnCustomerSignupReq, javax.swing.GroupLayout.PREFERRED_SIZE, 59, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(btnKiitchenSignupReq1, javax.swing.GroupLayout.PREFERRED_SIZE, 59, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(32, 32, 32) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) .addComponent(jSeparator1) .addComponent(jSeparator2, javax.swing.GroupLayout.DEFAULT_SIZE, 10, Short.MAX_VALUE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(lblManagerLogin, javax.swing.GroupLayout.PREFERRED_SIZE, 114, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(lblCustomerLogin, javax.swing.GroupLayout.PREFERRED_SIZE, 148, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(lblCustomerLogin1, javax.swing.GroupLayout.PREFERRED_SIZE, 136, javax.swing.GroupLayout.PREFERRED_SIZE)) .addContainerGap(121, Short.MAX_VALUE)) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel1Layout.createSequentialGroup() .addGap(189, 189, 189) .addComponent(jSeparator3, javax.swing.GroupLayout.PREFERRED_SIZE, 14, javax.swing.GroupLayout.PREFERRED_SIZE) .addContainerGap(273, Short.MAX_VALUE))) ); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) ); pack(); }// </editor-fold>//GEN-END:initComponents private void btnManagerLSignupReqActionPerformed(java.awt.event.ActionEvent {//GEN-FIRST:event_btnManagerLSignupReqActionPerformed evt) // TODO add your handling code here: type = "Manager"; openSignUpForm(); }//GEN-LAST:event_btnManagerLSignupReqActionPerformed private void btnCustomerSignupReqActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnCustomerSignupReqActionPerformed // TODO add your handling code here: type = "Customer"; openSignUpForm(); }//GEN-LAST:event_btnCustomerSignupReqActionPerformed private void btnKiitchenSignupReq1ActionPerformed(java.awt.event.ActionEvent evt) {//GENFIRST:event_btnKiitchenSignupReq1ActionPerformed // TODO add your handling code here: type = "Kitchen"; openSignUpForm(); }//GEN-LAST:event_btnKiitchenSignupReq1ActionPerformed /** * @param args the command line arguments */ public static void main(String args[]) { /* Set the Nimbus look and feel */ //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) "> /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel. * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html */ try { for (javax.swing.UIManager.LookAndFeelInfo info javax.swing.UIManager.getInstalledLookAndFeels()) { if ("Nimbus".equals(info.getName())) { javax.swing.UIManager.setLookAndFeel(info.getClassName()); break; } } } catch (ClassNotFoundException ex) { java.util.logging.Logger.getLogger(SignupRequestForm.class.getName()).log(java.util.logging.Le vel.SEVERE, null, ex); } catch (InstantiationException ex) { java.util.logging.Logger.getLogger(SignupRequestForm.class.getName()).log(java.util.logging.Le vel.SEVERE, null, ex); } catch (IllegalAccessException ex) { java.util.logging.Logger.getLogger(SignupRequestForm.class.getName()).log(java.util.logging.Le vel.SEVERE, null, ex); } catch (javax.swing.UnsupportedLookAndFeelException ex) { java.util.logging.Logger.getLogger(SignupRequestForm.class.getName()).log(java.util.logging.Le vel.SEVERE, null, ex); : } //</editor-fold> /* Create and display the form */ java.awt.EventQueue.invokeLater(new Runnable() { public void run() { new SignupRequestForm().setVisible(true); } }); } // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JButton btnCustomerSignupReq; private javax.swing.JButton btnKiitchenSignupReq1; private javax.swing.JButton btnManagerLSignupReq; private javax.swing.JPanel jPanel1; private javax.swing.JPanel jPanel2; private javax.swing.JSeparator jSeparator1; private javax.swing.JSeparator jSeparator2; private javax.swing.JSeparator jSeparator3; private javax.swing.JLabel lbLogo; private javax.swing.JLabel lblCustomerLogin; private javax.swing.JLabel lblCustomerLogin1; private javax.swing.JLabel lblManagerLogin; // End of variables declaration//GEN-END:variables } 2. SignUp Form: /* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package starting; import customerPackage.Customer; import customerPackage.CustomerWelcomeForm; import javax.swing.JOptionPane; import managerPackage.Manager; import kitchenPackage.Kitchen; /** * * @author ishik */ public class SignUpForm extends javax.swing.JFrame { /** * Creates new form SignUpForm */ String type; public SignUpForm() { initComponents(); this.setLocationRelativeTo(null); //center form in screen } public SignUpForm(String s) { initComponents(); txtPasswordSignup.setEchoChar('*'); this.setLocationRelativeTo(null); //center form in screen type = s; if ("Manager".equals(type)) { lbAddressSignup.setVisible(false); txtAddressSignup.setVisible(false); } txtPhoneSignup.setText(""); } /** * */ public static void setTextField() { txtUsernameSignup.setText(""); } /** * */ /** * This method is called from within the constructor to initialize the form. * WARNING: Do NOT modify this code. The content of this method is always * regenerated by the Form Editor. */ @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated BEGIN:initComponents private void initComponents() { pnlSignUp = new javax.swing.JPanel(); lbLogo = new javax.swing.JLabel(); lbNameSignup = new javax.swing.JLabel(); txtPhoneSignup = new javax.swing.JTextField(); lblPasswordSignup = new javax.swing.JLabel(); btnSignUp = new javax.swing.JButton(); txtPasswordSignup = new javax.swing.JPasswordField(); jPanel1 = new javax.swing.JPanel(); lbLogo1 = new javax.swing.JLabel(); lbAddressSignup = new javax.swing.JLabel(); Code">//GEN- lbMobileSignup = new javax.swing.JLabel(); txtUsernameSignup = new javax.swing.JTextField(); txtAddressSignup = new javax.swing.JTextField(); lbUsernameSignup = new javax.swing.JLabel(); txtNameSignup = new javax.swing.JTextField(); setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); setTitle("SIGNUP"); setUndecorated(true); pnlSignUp.setBackground(new java.awt.Color(255, 255, 255)); lbLogo.setBackground(new java.awt.Color(255, 255, 255)); lbLogo.setFont(new java.awt.Font("Rockwell Condensed", 0, 55)); // NOI18N lbLogo.setForeground(new java.awt.Color(127, 72, 101)); lbLogo.setText("Create Account"); lbLogo.setToolTipText(""); lbNameSignup.setFont(new java.awt.Font("Rockwell", 0, 22)); // NOI18N lbNameSignup.setText("Name"); txtPhoneSignup.setFont(new java.awt.Font("Rockwell", 0, 22)); // NOI18N txtPhoneSignup.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(127, 72, 101))); txtPhoneSignup.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { txtPhoneSignupActionPerformed(evt); } }); lblPasswordSignup.setFont(new java.awt.Font("Rockwell", 0, 22)); // NOI18N lblPasswordSignup.setText("Password"); btnSignUp.setBackground(new java.awt.Color(255, 213, 0)); btnSignUp.setFont(new java.awt.Font("Rockwell", 0, 24)); // NOI18N btnSignUp.setForeground(new java.awt.Color(127, 72, 101)); btnSignUp.setText("CREATE YOUR ACCOUNT"); btnSignUp.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR)); btnSignUp.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnSignUpActionPerformed(evt); } }); txtPasswordSignup.setFont(new java.awt.Font("Rockwell", 0, 18)); // NOI18N txtPasswordSignup.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(127, 72, 101))); txtPasswordSignup.setName(""); // NOI18N txtPasswordSignup.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { txtPasswordSignupActionPerformed(evt); } }); jPanel1.setBackground(new java.awt.Color(255, 213, 0)); jPanel1.setPreferredSize(new java.awt.Dimension(144, 70)); lbLogo1.setBackground(new java.awt.Color(255, 255, 255)); lbLogo1.setFont(new java.awt.Font("Rockwell Condensed", 0, 48)); // NOI18N lbLogo1.setForeground(new java.awt.Color(127, 72, 101)); lbLogo1.setText("GUSTO"); lbLogo1.setToolTipText(""); javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1); jPanel1.setLayout(jPanel1Layout); jPanel1Layout.setHorizontalGroup( jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel1Layout.createSequentialGroup() .addContainerGap() .addComponent(lbLogo1, javax.swing.GroupLayout.PREFERRED_SIZE, 237, javax.swing.GroupLayout.PREFERRED_SIZE) .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) ); jPanel1Layout.setVerticalGroup( jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel1Layout.createSequentialGroup() .addContainerGap() .addComponent(lbLogo1) .addContainerGap(18, Short.MAX_VALUE)) ); lbAddressSignup.setFont(new java.awt.Font("Rockwell", 0, 22)); // NOI18N lbAddressSignup.setText("Address"); lbMobileSignup.setFont(new java.awt.Font("Rockwell", 0, 22)); // NOI18N lbMobileSignup.setText("Mobile Phone"); txtUsernameSignup.setFont(new java.awt.Font("Rockwell", 0, 22)); // NOI18N txtUsernameSignup.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(127, 72, 101))); txtUsernameSignup.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { txtUsernameSignupActionPerformed(evt); } }); txtAddressSignup.setFont(new java.awt.Font("Rockwell", 0, 22)); // NOI18N txtAddressSignup.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(127, 72, 101))); txtAddressSignup.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { txtAddressSignupActionPerformed(evt); } }); lbUsernameSignup.setFont(new java.awt.Font("Rockwell", 0, 22)); // NOI18N lbUsernameSignup.setText("Username"); txtNameSignup.setFont(new java.awt.Font("Rockwell", 0, 22)); // NOI18N txtNameSignup.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(127, 72, 101))); txtNameSignup.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { txtNameSignupActionPerformed(evt); } }); javax.swing.GroupLayout pnlSignUpLayout = new javax.swing.GroupLayout(pnlSignUp); pnlSignUp.setLayout(pnlSignUpLayout); pnlSignUpLayout.setHorizontalGroup( pnlSignUpLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, 558, Short.MAX_VALUE) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, pnlSignUpLayout.createSequentialGroup() .addContainerGap(133, Short.MAX_VALUE) .addComponent(lbLogo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(113, 113, 113)) .addGroup(pnlSignUpLayout.createSequentialGroup() .addGap(28, 28, 28) 312, .addGroup(pnlSignUpLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADI NG) .addGroup(pnlSignUpLayout.createSequentialGroup() .addComponent(lbNameSignup, javax.swing.GroupLayout.PREFERRED_SIZE, 110, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(txtNameSignup, javax.swing.GroupLayout.PREFERRED_SIZE, 319, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, pnlSignUpLayout.createSequentialGroup() .addComponent(lbMobileSignup) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(txtPhoneSignup, javax.swing.GroupLayout.PREFERRED_SIZE, 319, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGroup(pnlSignUpLayout.createSequentialGroup() .addGroup(pnlSignUpLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADI NG) .addComponent(lblPasswordSignup, javax.swing.GroupLayout.PREFERRED_SIZE, 109, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(lbAddressSignup, javax.swing.GroupLayout.PREFERRED_SIZE, 101, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addGroup(pnlSignUpLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAIL ING, false) .addComponent(txtPasswordSignup, javax.swing.GroupLayout.DEFAULT_SIZE, 319, Short.MAX_VALUE) .addComponent(txtAddressSignup))) .addGroup(pnlSignUpLayout.createSequentialGroup() .addComponent(lbUsernameSignup) .addGap(78, 78, 78) .addComponent(txtUsernameSignup))) .addGap(29, 29, 29)) .addGroup(pnlSignUpLayout.createSequentialGroup() .addGap(106, 106, 106) .addComponent(btnSignUp) .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) ); pnlSignUpLayout.setVerticalGroup( pnlSignUpLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(pnlSignUpLayout.createSequentialGroup() .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, 86, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, Short.MAX_VALUE) .addComponent(lbLogo) .addGap(53, 53, 53) 47, .addGroup(pnlSignUpLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASE LINE) .addComponent(lbNameSignup, javax.swing.GroupLayout.PREFERRED_SIZE, 34, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(txtNameSignup, javax.swing.GroupLayout.PREFERRED_SIZE, 34, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(29, 29, 29) .addGroup(pnlSignUpLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASE LINE) .addComponent(lbMobileSignup, javax.swing.GroupLayout.PREFERRED_SIZE, 34, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(txtPhoneSignup, javax.swing.GroupLayout.PREFERRED_SIZE, 34, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(28, 28, 28) .addGroup(pnlSignUpLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASE LINE) .addComponent(lbUsernameSignup, javax.swing.GroupLayout.PREFERRED_SIZE, 34, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(txtUsernameSignup, javax.swing.GroupLayout.PREFERRED_SIZE, 34, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(33, 33, 33) .addGroup(pnlSignUpLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASE LINE) .addComponent(lblPasswordSignup, javax.swing.GroupLayout.PREFERRED_SIZE, 29, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(txtPasswordSignup, javax.swing.GroupLayout.PREFERRED_SIZE, 39, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(32, 32, 32) .addGroup(pnlSignUpLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASE LINE) .addComponent(lbAddressSignup, javax.swing.GroupLayout.PREFERRED_SIZE, 34, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(txtAddressSignup, javax.swing.GroupLayout.PREFERRED_SIZE, 34, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(49, 49, 49) .addComponent(btnSignUp, javax.swing.GroupLayout.PREFERRED_SIZE, 56, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(46, 46, 46)) ); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addComponent(pnlSignUp, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(0, 0, Short.MAX_VALUE)) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(pnlSignUp, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) ); pack(); }// </editor-fold>//GEN-END:initComponents private void txtPhoneSignupActionPerformed(java.awt.event.ActionEvent evt) {//GENFIRST:event_txtPhoneSignupActionPerformed // TODO add your handling code here: }//GEN-LAST:event_txtPhoneSignupActionPerformed private void txtPasswordSignupActionPerformed(java.awt.event.ActionEvent evt) {//GENFIRST:event_txtPasswordSignupActionPerformed // TODO add your handling code here: }//GEN-LAST:event_txtPasswordSignupActionPerformed private void txtUsernameSignupActionPerformed(java.awt.event.ActionEvent evt) {//GENFIRST:event_txtUsernameSignupActionPerformed // TODO add your handling code here: }//GEN-LAST:event_txtUsernameSignupActionPerformed private void txtAddressSignupActionPerformed(java.awt.event.ActionEvent evt) {//GENFIRST:event_txtAddressSignupActionPerformed // TODO add your handling code here: }//GEN-LAST:event_txtAddressSignupActionPerformed private void txtNameSignupActionPerformed(java.awt.event.ActionEvent evt) {//GENFIRST:event_txtNameSignupActionPerformed // TODO add your handling code here: }//GEN-LAST:event_txtNameSignupActionPerformed private void btnSignUpActionPerformed(java.awt.event.ActionEvent evt)//GEN- FIRST:event_btnSignUpActionPerformed {//GEN-HEADEREND:event_btnSignUpActionPerformed // TODO add your handling code here: try { String username = txtUsernameSignup.getText(); String password = String.valueOf(txtPasswordSignup.getPassword()); String mobilePhone = txtPhoneSignup.getText(); String name = txtNameSignup.getText(); String address = txtAddressSignup.getText(); if (!username.isEmpty() && !password.isEmpty() && !mobilePhone.isEmpty() && !name.isEmpty()) { try { //int mobile = Integer.valueOf(mobilePhone); if (mobilePhone.length() < 10) { JOptionPane.showMessageDialog(this, "Invalid Mobile Phone, Mobile Phone must consist of 10 numbers", "Invalid Input", JOptionPane.ERROR_MESSAGE); txtPhoneSignup.setText(""); } else if (username.contains(" ")) { JOptionPane.showMessageDialog(this, "Username can't contain spaces", "Invalid Input", JOptionPane.ERROR_MESSAGE); txtUsernameSignup.setText(""); } else { if ("Manager".equals(type)) { Manager m = new Manager(name, username, mobilePhone, password); boolean success = m.register(); if (success) { this.dispose(); } } else if("Kitchen".equals(type)){ if (address.isEmpty()) { JOptionPane.showMessageDialog(this, "Please fill all TextFields", "Invalid Input", JOptionPane.ERROR_MESSAGE); } else { int id = kitchenPackage.Kitchen.getNoKitchens()+1; Kitchen c = new Kitchen(id, name, username, mobilePhone, password, address); boolean success = c.register(); if (success) { this.dispose(); } } } else //customer { if (address.isEmpty()) { JOptionPane.showMessageDialog(this, "Please fill all TextFields", "Invalid Input", JOptionPane.ERROR_MESSAGE); } else { int id = Customer.getNoCustomers()+1; Customer c = new Customer(id, name, username, mobilePhone, password, address); boolean success = c.register(); if (success) { this.dispose(); } } } } } catch (NumberFormatException ne) { JOptionPane.showMessageDialog(this, "Invalid Mobile Phone, please enter numbers only", "Invalid Input", JOptionPane.ERROR_MESSAGE); txtPhoneSignup.setText(""); } } else { JOptionPane.showMessageDialog(this, "Please fill all TextFields", "Invalid Input", JOptionPane.ERROR_MESSAGE); } } catch (Exception e) { JOptionPane.showMessageDialog(this, JOptionPane.ERROR_MESSAGE); } e.getMessage(), "Error", }//GEN-LAST:event_btnSignUpActionPerformed /** * @param args the command line arguments */ public static void main(String args[]) { /* Set the Nimbus look and feel */ //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) "> /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel. * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html */ try { for (javax.swing.UIManager.LookAndFeelInfo javax.swing.UIManager.getInstalledLookAndFeels()) { if ("Nimbus".equals(info.getName())) { javax.swing.UIManager.setLookAndFeel(info.getClassName()); break; } } } catch (ClassNotFoundException ex) { info : java.util.logging.Logger.getLogger(SignUpForm.class .getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (InstantiationException ex) { java.util.logging.Logger.getLogger(SignUpForm.class .getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (IllegalAccessException ex) { java.util.logging.Logger.getLogger(SignUpForm.class .getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (javax.swing.UnsupportedLookAndFeelException ex) { java.util.logging.Logger.getLogger(SignUpForm.class .getName()).log(java.util.logging.Level.SEVERE, null, ex); } //</editor-fold> /* Create and display the form */ java.awt.EventQueue.invokeLater(() -> { new SignUpForm().setVisible(true); }); } // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JButton btnSignUp; private javax.swing.JPanel jPanel1; private javax.swing.JLabel lbAddressSignup; private javax.swing.JLabel lbLogo; private javax.swing.JLabel lbLogo1; private javax.swing.JLabel lbMobileSignup; private javax.swing.JLabel lbNameSignup; private javax.swing.JLabel lbUsernameSignup; private javax.swing.JLabel lblPasswordSignup; private javax.swing.JPanel pnlSignUp; private javax.swing.JTextField txtAddressSignup; private javax.swing.JTextField txtNameSignup; private javax.swing.JPasswordField txtPasswordSignup; private javax.swing.JTextField txtPhoneSignup; private static javax.swing.JTextField txtUsernameSignup; // End of variables declaration//GEN-END:variables } 3. Login Request Form: /* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package starting; /** * * @author ishik */ public class LoginRequestForm extends javax.swing.JFrame { String type; /** * Creates new form LoginRequest */ public LoginRequestForm() { initComponents(); lblManagerLogin.setText("<html><body>Find everything you need<br> to manage your restaurant.</body></html>"); lblCustomerLogin.setText("<html><body>Find out the latest offers,<br> most selling food, review order<br> history,and more.</body></html>"); this.setLocationRelativeTo(null); //center form in screen } public void openLoginForm() { LoginForm login = new LoginForm(type); login.setVisible(true); this.dispose(); } /** * This method is called from within the constructor to initialize the form. * WARNING: Do NOT modify this code. The content of this method is always * regenerated by the Form Editor. */ @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN- BEGIN:initComponents private void initComponents() { jPanel1 = new javax.swing.JPanel(); btnManagerLoginReq = new javax.swing.JButton(); lblManagerLogin = new javax.swing.JLabel(); btnKitchenLoginReq = new javax.swing.JButton(); lblCustomerLogin = new javax.swing.JLabel(); jSeparator1 = new javax.swing.JSeparator(); jSeparator2 = new javax.swing.JSeparator(); jPanel2 = new javax.swing.JPanel(); lbLogo = new javax.swing.JLabel(); jSeparator3 = new javax.swing.JSeparator(); btnCustomerLoginReq1 = new javax.swing.JButton(); lblCustomerLogin1 = new javax.swing.JLabel(); setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); setTitle("Login Request"); setBackground(new java.awt.Color(255, 213, 0)); setUndecorated(true); jPanel1.setBackground(new java.awt.Color(255, 255, 255)); btnManagerLoginReq.setFont(new java.awt.Font("Rockwell Condensed", 1, 28)); // NOI18N btnManagerLoginReq.setBorderPainted(false); btnManagerLoginReq.setContentAreaFilled(false); btnManagerLoginReq.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR)); btnManagerLoginReq.setLabel("Manager Login"); btnManagerLoginReq.setName(""); // NOI18N btnManagerLoginReq.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnManagerLoginReqActionPerformed(evt); } }); lblManagerLogin.setFont(new java.awt.Font("Rockwell", 0, 18)); // NOI18N lblManagerLogin.setText("Find everything you need"); btnKitchenLoginReq.setBackground(new java.awt.Color(255, 213, 0)); btnKitchenLoginReq.setFont(new java.awt.Font("Rockwell Condensed", 1, 28)); // NOI18N btnKitchenLoginReq.setText("Kitchen Login"); btnKitchenLoginReq.setBorderPainted(false); btnKitchenLoginReq.setContentAreaFilled(false); btnKitchenLoginReq.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR)); btnKitchenLoginReq.setName(""); // NOI18N btnKitchenLoginReq.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnKitchenLoginReqActionPerformed(evt); } }); lblCustomerLogin.setFont(new java.awt.Font("Rockwell", 0, 18)); // NOI18N lblCustomerLogin.setText("Find everything you need"); jPanel2.setBackground(new java.awt.Color(255, 213, 0)); jPanel2.setPreferredSize(new java.awt.Dimension(396, 70)); lbLogo.setBackground(new java.awt.Color(255, 255, 255)); lbLogo.setFont(new java.awt.Font("Rockwell Condensed", 0, 55)); // NOI18N lbLogo.setForeground(new java.awt.Color(127, 72, 101)); lbLogo.setText("GUSTO"); lbLogo.setToolTipText(""); javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2); jPanel2.setLayout(jPanel2Layout); jPanel2Layout.setHorizontalGroup( jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel2Layout.createSequentialGroup() .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(lbLogo, javax.swing.GroupLayout.PREFERRED_SIZE, 394, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(178, 178, 178)) ); jPanel2Layout.setVerticalGroup( jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel2Layout.createSequentialGroup() .addComponent(lbLogo) .addGap(0, 0, Short.MAX_VALUE)) ); btnCustomerLoginReq1.setBackground(new java.awt.Color(255, 213, 0)); btnCustomerLoginReq1.setFont(new java.awt.Font("Rockwell Condensed", 1, 28)); // NOI18N btnCustomerLoginReq1.setText("Customer Login"); btnCustomerLoginReq1.setBorderPainted(false); btnCustomerLoginReq1.setContentAreaFilled(false); btnCustomerLoginReq1.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR)); btnCustomerLoginReq1.setName(""); // NOI18N btnCustomerLoginReq1.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnCustomerLoginReq1ActionPerformed(evt); } }); lblCustomerLogin1.setFont(new java.awt.Font("Rockwell", 0, 18)); // NOI18N lblCustomerLogin1.setText("Find everything you need related to kitchen staff"); javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1); jPanel1.setLayout(jPanel1Layout); jPanel1Layout.setHorizontalGroup( jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jPanel2, javax.swing.GroupLayout.DEFAULT_SIZE, 971, Short.MAX_VALUE) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup() .addContainerGap() .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADIN G) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup() .addComponent(btnManagerLoginReq, javax.swing.GroupLayout.PREFERRED_SIZE, 255, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(44, 44, 44)) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup() .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADIN G, false) .addComponent(lblManagerLogin, javax.swing.GroupLayout.DEFAULT_SIZE, 232, Short.MAX_VALUE) .addComponent(jSeparator2)) .addGap(48, 48, 48))) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADIN G) .addComponent(lblCustomerLogin, javax.swing.GroupLayout.PREFERRED_SIZE, 245, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(btnCustomerLoginReq1, javax.swing.GroupLayout.PREFERRED_SIZE, 255, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 30, Short.MAX_VALUE) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADIN G) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup() .addComponent(btnKitchenLoginReq, javax.swing.GroupLayout.PREFERRED_SIZE, 255, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(44, 44, 44)) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup() .addComponent(jSeparator1, javax.swing.GroupLayout.PREFERRED_SIZE, 255, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(26, 26, 26)) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup() .addComponent(lblCustomerLogin1, javax.swing.GroupLayout.PREFERRED_SIZE, 375, javax.swing.GroupLayout.PREFERRED_SIZE) .addContainerGap()))) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADIN G) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup() .addContainerGap(306, Short.MAX_VALUE) .addComponent(jSeparator3, javax.swing.GroupLayout.PREFERRED_SIZE, 262, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(349, 349, 349))) ); jPanel1Layout.setVerticalGroup( jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel1Layout.createSequentialGroup() .addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(26, 26, 26) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELIN E) .addComponent(btnCustomerLoginReq1, javax.swing.GroupLayout.PREFERRED_SIZE, 59, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(btnKitchenLoginReq, javax.swing.GroupLayout.PREFERRED_SIZE, 59, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(btnManagerLoginReq, javax.swing.GroupLayout.PREFERRED_SIZE, 59, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(18, 18, 18) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADIN G) .addGroup(jPanel1Layout.createSequentialGroup() .addComponent(jSeparator2, javax.swing.GroupLayout.PREFERRED_SIZE, 10, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(lblManagerLogin, javax.swing.GroupLayout.PREFERRED_SIZE, 114, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGroup(jPanel1Layout.createSequentialGroup() .addComponent(jSeparator1, javax.swing.GroupLayout.PREFERRED_SIZE, 10, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(lblCustomerLogin1, javax.swing.GroupLayout.PREFERRED_SIZE, 109, javax.swing.GroupLayout.PREFERRED_SIZE)) .addComponent(lblCustomerLogin, javax.swing.GroupLayout.PREFERRED_SIZE, 148, javax.swing.GroupLayout.PREFERRED_SIZE)) .addContainerGap(154, Short.MAX_VALUE)) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADIN G) .addGroup(jPanel1Layout.createSequentialGroup() .addGap(173, 173, 173) .addComponent(jSeparator3, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE) .addContainerGap(224, Short.MAX_VALUE))) ); btnManagerLoginReq.getAccessibleContext().setAccessibleName(""); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(0, 0, Short.MAX_VALUE)) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(0, 0, Short.MAX_VALUE)) ); pack(); }// </editor-fold>//GEN-END:initComponents private void btnKitchenLoginReqActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnKitchenLoginReqActionPerformed type = "Kitchen"; openLoginForm(); }//GEN-LAST:event_btnKitchenLoginReqActionPerformed private void btnManagerLoginReqActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnManagerLoginReqActionPerformed // TODO add your handling code here: type = "Manager"; openLoginForm(); }//GEN-LAST:event_btnManagerLoginReqActionPerformed private void btnCustomerLoginReq1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnCustomerLoginReq1ActionPerformed // TODO add your handling code here: // TODO add your handling code here: type = "Customer"; openLoginForm(); }//GEN-LAST:event_btnCustomerLoginReq1ActionPerformed /** * @param args the command line arguments */ public static void main(String args[]) { /* Set the Nimbus look and feel */ //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) "> /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel. * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html */ try { for (javax.swing.UIManager.LookAndFeelInfo info javax.swing.UIManager.getInstalledLookAndFeels()) { if ("Nimbus".equals(info.getName())) { javax.swing.UIManager.setLookAndFeel(info.getClassName()); break; } } } catch (ClassNotFoundException ex) { java.util.logging.Logger.getLogger(LoginRequestForm.class.getName()).log(java.util.logging. Level.SEVERE, null, ex); : } catch (InstantiationException ex) { java.util.logging.Logger.getLogger(LoginRequestForm.class.getName()).log(java.util.logging. Level.SEVERE, null, ex); } catch (IllegalAccessException ex) { java.util.logging.Logger.getLogger(LoginRequestForm.class.getName()).log(java.util.logging. Level.SEVERE, null, ex); } catch (javax.swing.UnsupportedLookAndFeelException ex) { java.util.logging.Logger.getLogger(LoginRequestForm.class.getName()).log(java.util.logging. Level.SEVERE, null, ex); } //</editor-fold> //</editor-fold> /* Create and display the form */ java.awt.EventQueue.invokeLater(new Runnable() { public void run() { new LoginRequestForm().setVisible(true); } }); } // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JButton btnCustomerLoginReq1; private javax.swing.JButton btnKitchenLoginReq; private javax.swing.JButton btnManagerLoginReq; private javax.swing.JPanel jPanel1; private javax.swing.JPanel jPanel2; private javax.swing.JSeparator jSeparator1; private javax.swing.JSeparator jSeparator2; private javax.swing.JSeparator jSeparator3; private javax.swing.JLabel lbLogo; private javax.swing.JLabel lblCustomerLogin; private javax.swing.JLabel lblCustomerLogin1; private javax.swing.JLabel lblManagerLogin; // End of variables declaration//GEN-END:variables } 4. Login Form: /* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package starting; import customerPackage.Customer; import javax.swing.JOptionPane; import managerPackage.Manager; import kitchenPackage.Kitchen; /** * * @author ishik */ public class LoginForm extends javax.swing.JFrame { String type; /** * Creates new form Login */ public LoginForm() { initComponents(); this.setLocationRelativeTo(null); //center form in screen } public LoginForm(String s) { initComponents(); txtPasswordLogin.setEchoChar('*'); type = s; this.setLocationRelativeTo(null); //center form in screen } public static void setTextFields() { txtUsernameLogin.setText(""); txtPasswordLogin.setText(""); } /** * This method is called from within the constructor to initialize the form. * WARNING: Do NOT modify this code. The content of this method is always * regenerated by the Form Editor. */ @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { pnlLogin = new javax.swing.JPanel(); lbLogo = new javax.swing.JLabel(); lbUsernameLogin = new javax.swing.JLabel(); txtUsernameLogin = new javax.swing.JTextField(); lblPasswordLogin = new javax.swing.JLabel(); btnLogin = new javax.swing.JButton(); txtPasswordLogin = new javax.swing.JPasswordField(); jPanel1 = new javax.swing.JPanel(); lbLogo1 = new javax.swing.JLabel(); setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); setTitle("LOGIN"); setBackground(new java.awt.Color(255, 213, 0)); setName("Login"); // NOI18N setUndecorated(true); pnlLogin.setBackground(new java.awt.Color(255, 255, 255)); lbLogo.setBackground(new java.awt.Color(255, 255, 255)); lbLogo.setFont(new java.awt.Font("Rockwell Condensed", 0, 55)); // NOI18N lbLogo.setForeground(new java.awt.Color(127, 72, 101)); lbLogo.setText("Login"); lbLogo.setToolTipText(""); lbUsernameLogin.setFont(new java.awt.Font("Rockwell", 0, 22)); // NOI18N lbUsernameLogin.setText("Username"); txtUsernameLogin.setFont(new java.awt.Font("Rockwell", 0, 22)); // NOI18N txtUsernameLogin.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(127, 72, 101))); txtUsernameLogin.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { txtUsernameLoginActionPerformed(evt); } }); lblPasswordLogin.setFont(new java.awt.Font("Rockwell", 0, 22)); // NOI18N lblPasswordLogin.setText("Password"); btnLogin.setBackground(new java.awt.Color(255, 213, 0)); btnLogin.setFont(new java.awt.Font("Rockwell", 0, 24)); // NOI18N btnLogin.setForeground(new java.awt.Color(127, 72, 101)); btnLogin.setText("LOGIN"); btnLogin.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR)); btnLogin.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnLoginActionPerformed(evt); } }); txtPasswordLogin.setFont(new java.awt.Font("Rockwell", 0, 18)); // NOI18N txtPasswordLogin.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(127, 72, 101))); txtPasswordLogin.setCursor(new java.awt.Cursor(java.awt.Cursor.TEXT_CURSOR)); txtPasswordLogin.setName(""); // NOI18N txtPasswordLogin.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { txtPasswordLoginActionPerformed(evt); } }); jPanel1.setBackground(new java.awt.Color(255, 213, 0)); jPanel1.setPreferredSize(new java.awt.Dimension(144, 70)); lbLogo1.setBackground(new java.awt.Color(255, 255, 255)); lbLogo1.setFont(new java.awt.Font("Rockwell Condensed", 0, 48)); // NOI18N lbLogo1.setForeground(new java.awt.Color(127, 72, 101)); lbLogo1.setText("GUSTO"); lbLogo1.setToolTipText(""); javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1); jPanel1.setLayout(jPanel1Layout); jPanel1Layout.setHorizontalGroup( jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel1Layout.createSequentialGroup() .addContainerGap() .addComponent(lbLogo1, javax.swing.GroupLayout.PREFERRED_SIZE, 182, javax.swing.GroupLayout.PREFERRED_SIZE) .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) ); jPanel1Layout.setVerticalGroup( jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup() .addGap(0, 8, Short.MAX_VALUE) .addComponent(lbLogo1)) ); javax.swing.GroupLayout pnlLoginLayout = new javax.swing.GroupLayout(pnlLogin); pnlLogin.setLayout(pnlLoginLayout); pnlLoginLayout.setHorizontalGroup( pnlLoginLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, 435, Short.MAX_VALUE) .addGroup(pnlLoginLayout.createSequentialGroup() .addGroup(pnlLoginLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(pnlLoginLayout.createSequentialGroup() .addGap(76, 76, 76) .addComponent(btnLogin, javax.swing.GroupLayout.PREFERRED_SIZE, 272, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGroup(pnlLoginLayout.createSequentialGroup() .addGap(25, 25, 25) .addGroup(pnlLoginLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(lbUsernameLogin) .addComponent(lblPasswordLogin, javax.swing.GroupLayout.PREFERRED_SIZE, 109, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(25, 25, 25) .addGroup(pnlLoginLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) .addComponent(txtUsernameLogin, javax.swing.GroupLayout.DEFAULT_SIZE, 242, Short.MAX_VALUE) .addComponent(txtPasswordLogin) .addComponent(lbLogo, javax.swing.GroupLayout.PREFERRED_SIZE, 176, javax.swing.GroupLayout.PREFERRED_SIZE)))) .addContainerGap(34, Short.MAX_VALUE)) ); pnlLoginLayout.setVerticalGroup( pnlLoginLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(pnlLoginLayout.createSequentialGroup() .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(46, 46, 46) .addComponent(lbLogo) .addGap(28, 28, 28) .addGroup(pnlLoginLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(txtUsernameLogin, javax.swing.GroupLayout.PREFERRED_SIZE, 34, javax.swing.GroupLayout.PREFERRED_SIZE, 34, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(lbUsernameLogin, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 77, Short.MAX_VALUE) .addGroup(pnlLoginLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(txtPasswordLogin, javax.swing.GroupLayout.PREFERRED_SIZE, 39, javax.swing.GroupLayout.PREFERRED_SIZE, 29, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(lblPasswordLogin, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(59, 59, 59) .addComponent(btnLogin, javax.swing.GroupLayout.PREFERRED_SIZE, 49, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(62, 62, 62)) ); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGap(0, 435, Short.MAX_VALUE) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(pnlLogin, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) ); javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGap(0, 529, Short.MAX_VALUE) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(pnlLogin, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) ); pack(); }// </editor-fold>//GEN-END:initComponents private void txtUsernameLoginActionPerformed(java.awt.event.ActionEvent evt) {//GEN- evt) {//GEN- FIRST:event_txtUsernameLoginActionPerformed // TODO add your handling code here: }//GEN-LAST:event_txtUsernameLoginActionPerformed private void txtPasswordLoginActionPerformed(java.awt.event.ActionEvent FIRST:event_txtPasswordLoginActionPerformed // TODO add your handling code here: }//GEN-LAST:event_txtPasswordLoginActionPerformed private void btnLoginActionPerformed(java.awt.event.ActionEvent FIRST:event_btnLoginActionPerformed try { String username = txtUsernameLogin.getText(); String password = String.valueOf(txtPasswordLogin.getPassword()); if (!username.isEmpty() && !password.isEmpty()) { evt) {//GEN- if ("Manager".equals(type)) { //logging in as manager Manager m = new Manager(); boolean success = m.login(username, password); //search in Managers DB if (success) { this.dispose(); } } else if ("Kitchen".equals(type)){ Kitchen kit = new Kitchen(); boolean success = kit.login(username, password); if (success) { this.dispose(); } } else { //logging in as customer Customer c = new Customer(); boolean success = c.login(username, password); //search in customers DB if (success) { this.dispose(); } } } else { JOptionPane.showMessageDialog(this, "Please fill both TextFields", "Invalid Input", JOptionPane.ERROR_MESSAGE); } } catch (Exception e) { JOptionPane.showMessageDialog(this, e.getMessage(), "Error", JOptionPane.ERROR_MESSAGE); } }//GEN-LAST:event_btnLoginActionPerformed /** * @param args the command line arguments */ public static void main(String args[]) { /* Set the Nimbus look and feel */ //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) "> /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel. * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html */ try { for (javax.swing.UIManager.LookAndFeelInfo javax.swing.UIManager.getInstalledLookAndFeels()) info : { if ("Nimbus".equals(info.getName())) { javax.swing.UIManager.setLookAndFeel(info.getClassName()); break; } } } catch (ClassNotFoundException ex) { java.util.logging.Logger.getLogger(LoginForm.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (InstantiationException ex) { java.util.logging.Logger.getLogger(LoginForm.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (IllegalAccessException ex) { java.util.logging.Logger.getLogger(LoginForm.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (javax.swing.UnsupportedLookAndFeelException ex) { java.util.logging.Logger.getLogger(LoginForm.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } //</editor-fold> //</editor-fold> /* Create and display the form */ java.awt.EventQueue.invokeLater(() -> { new LoginForm().setVisible(true); }); } // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JButton btnLogin; private javax.swing.JPanel jPanel1; private javax.swing.JLabel lbLogo; private javax.swing.JLabel lbLogo1; private javax.swing.JLabel lbUsernameLogin; private javax.swing.JLabel lblPasswordLogin; private javax.swing.JPanel pnlLogin; private static javax.swing.JPasswordField txtPasswordLogin; private static javax.swing.JTextField txtUsernameLogin; // End of variables declaration//GEN-END:variables } 5. Homepage Form: package starting; /* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ import menuItems.Menu; import gustorestaurant.User; import java.util.ArrayList; import managerPackage.Announcement; import menuItems.Inventory; import menuItems.MainMenu; /** * * @author ishik */ public class HomepageForm extends javax.swing.JFrame { public static ArrayList<Announcement> offers; /** * Creates new form HomepageForm */ public HomepageForm() { initComponents(); lblText.setText("<html><body>Discover & Order<br> love.</body></html>"); //to enable multiple lines this.setLocationRelativeTo(null); //center form in screen the food you MainMenu.categoryList.clear(); MainMenu mainmenu = new MainMenu(); mainmenu.setCategoryItem(); //load main menu Inventory inventory = new Inventory(); inventory.setInventoryItems(); //load inventory offers = new ArrayList<>(); User.viewAnnouncements(); //load offers //this.setState(this.ICONIFIED); //minimize //System.exit(0); } public HomepageForm(boolean b) { initComponents(); lblText.setText("<html><body>Discover & Order<br> the food you love.</body></html>"); //to enable multiple lines this.setLocationRelativeTo(null); //center form in screen } /** * This method is called from within the constructor to initialize the form. * WARNING: Do NOT modify this code. The content of this method is always * regenerated by the Form Editor. */ @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" BEGIN:initComponents private void initComponents() { desc="Generated Code">//GEN- pHeader = new javax.swing.JPanel(); lbLogo = new javax.swing.JLabel(); btnLogin = new javax.swing.JButton(); btnSignup = new javax.swing.JButton(); btnMenuHomePage = new javax.swing.JButton(); jLayeredPane1 = new javax.swing.JLayeredPane(); lblText = new javax.swing.JLabel(); lblHomeImage = new javax.swing.JLabel(); setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); setTitle("Gusto Restaurant"); setBackground(new java.awt.Color(0, 51, 51)); setIconImages(null); setLocation(new java.awt.Point(100, 100)); setMinimumSize(new java.awt.Dimension(1217, 871)); setName("HomePage"); // NOI18N setPreferredSize(new java.awt.Dimension(1217, 871)); getContentPane().setLayout(null); pHeader.setBackground(new java.awt.Color(255, 213, 0)); pHeader.setMinimumSize(new java.awt.Dimension(1220, 80)); pHeader.setName("pHeader"); // NOI18N pHeader.setPreferredSize(new java.awt.Dimension(1220, 80)); pHeader.setLayout(null); lbLogo.setBackground(new java.awt.Color(255, 255, 255)); lbLogo.setFont(new java.awt.Font("Rockwell Condensed", 0, 52)); // NOI18N lbLogo.setForeground(new java.awt.Color(127, 72, 101)); lbLogo.setText("GUSTO"); lbLogo.setToolTipText(""); pHeader.add(lbLogo); lbLogo.setBounds(29, 13, 200, 67); btnLogin.setBackground(new java.awt.Color(255, 213, 0)); btnLogin.setFont(new java.awt.Font("Rockwell", 0, 30)); // NOI18N btnLogin.setForeground(new java.awt.Color(127, 72, 101)); btnLogin.setText("LOGIN"); btnLogin.setBorder(null); btnLogin.setBorderPainted(false); btnLogin.setContentAreaFilled(false); btnLogin.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR)); btnLogin.setPreferredSize(new java.awt.Dimension(87, 29)); btnLogin.setRequestFocusEnabled(false); btnLogin.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnLoginActionPerformed(evt); } }); pHeader.add(btnLogin); btnLogin.setBounds(890, 20, 130, 50); btnSignup.setBackground(new java.awt.Color(255, 213, 0)); btnSignup.setFont(new java.awt.Font("Rockwell", 0, 30)); // NOI18N btnSignup.setForeground(new java.awt.Color(127, 72, 101)); btnSignup.setText("SIGNUP"); btnSignup.setToolTipText(""); btnSignup.setBorder(null); btnSignup.setBorderPainted(false); btnSignup.setContentAreaFilled(false); btnSignup.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR)); btnSignup.setName(""); // NOI18N btnSignup.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnSignupActionPerformed(evt); } }); pHeader.add(btnSignup); btnSignup.setBounds(1070, 20, 121, 50); btnMenuHomePage.setBackground(new java.awt.Color(255, 213, 0)); btnMenuHomePage.setFont(new java.awt.Font("Rockwell", 0, 30)); // NOI18N btnMenuHomePage.setForeground(new java.awt.Color(127, 72, 101)); btnMenuHomePage.setText("MENU"); btnMenuHomePage.setBorder(null); btnMenuHomePage.setBorderPainted(false); btnMenuHomePage.setContentAreaFilled(false); btnMenuHomePage.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR)); btnMenuHomePage.setPreferredSize(new java.awt.Dimension(87, 29)); btnMenuHomePage.setRequestFocusEnabled(false); btnMenuHomePage.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnMenuHomePageActionPerformed(evt); } }); pHeader.add(btnMenuHomePage); btnMenuHomePage.setBounds(720, 20, 140, 50); getContentPane().add(pHeader); pHeader.setBounds(0, 0, 1220, 80); jLayeredPane1.setMinimumSize(new java.awt.Dimension(1062, 627)); jLayeredPane1.setPreferredSize(new java.awt.Dimension(1261, 788)); lblText.setFont(new java.awt.Font("Rockwell Condensed", 1, 50)); // NOI18N lblText.setForeground(new java.awt.Color(255, 255, 255)); lblText.setText("Discover & Order"); lblText.setName(""); // NOI18N jLayeredPane1.add(lblText); lblText.setBounds(780, 310, 470, 170); getContentPane().add(jLayeredPane1); jLayeredPane1.setBounds(0, 80, 1220, 780); lblHomeImage.setIcon(new javax.swing.ImageIcon(getClass().getResource("/starting/r22.jpg"))); // NOI18N getContentPane().add(lblHomeImage); lblHomeImage.setBounds(0, 50, 1220, 910); pack(); }// </editor-fold>//GEN-END:initComponents private void btnLoginActionPerformed(java.awt.event.ActionEvent evt) {//GEN- evt) {//GEN- FIRST:event_btnLoginActionPerformed // TODO add your handling code here: LoginRequestForm login = new LoginRequestForm(); login.setVisible(true); //this.dispose(); }//GEN-LAST:event_btnLoginActionPerformed private void btnSignupActionPerformed(java.awt.event.ActionEvent FIRST:event_btnSignupActionPerformed // TODO add your handling code here: SignupRequestForm signup = new SignupRequestForm(); signup.setVisible(true); //this.dispose(); }//GEN-LAST:event_btnSignupActionPerformed private void btnMenuHomePageActionPerformed(java.awt.event.ActionEvent evt) {//GENFIRST:event_btnMenuHomePageActionPerformed // TODO add your handling code here: Menu m=new Menu(); m.setVisible(true); }//GEN-LAST:event_btnMenuHomePageActionPerformed /** * @param args the command line arguments */ public static void main(String args[]) { /* Set the Nimbus look and feel */ //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) "> /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel. * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html */ try { for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) { if ("Nimbus".equals(info.getName())) { javax.swing.UIManager.setLookAndFeel(info.getClassName()); break; } } } catch (ClassNotFoundException ex) { java.util.logging.Logger.getLogger(HomepageForm.class.getName()).log(java.util.logging.Leve l.SEVERE, null, ex); } catch (InstantiationException ex) { java.util.logging.Logger.getLogger(HomepageForm.class.getName()).log(java.util.logging.Leve l.SEVERE, null, ex); } catch (IllegalAccessException ex) { java.util.logging.Logger.getLogger(HomepageForm.class.getName()).log(java.util.logging.Leve l.SEVERE, null, ex); } catch (javax.swing.UnsupportedLookAndFeelException ex) { java.util.logging.Logger.getLogger(HomepageForm.class.getName()).log(java.util.logging.Leve l.SEVERE, null, ex); } //</editor-fold> //</editor-fold> /* Create and display the form */ java.awt.EventQueue.invokeLater(new Runnable() { public void run() { new HomepageForm().setVisible(true); } }); } // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JButton btnLogin; private javax.swing.JButton btnMenuHomePage; private javax.swing.JButton btnSignup; private javax.swing.JLayeredPane jLayeredPane1; private javax.swing.JLabel lbLogo; private javax.swing.JLabel lblHomeImage; private javax.swing.JLabel lblText; private javax.swing.JPanel pHeader; // End of variables declaration//GEN-END:variables } 6. Menu: package menuItems; import java.awt.Color; import java.util.HashMap; import javax.swing.ImageIcon; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JScrollPane; import javax.swing.JTextArea; import menuItems.MainMenu; import static starting.HomepageForm.offers; public class Menu extends javax.swing.JFrame { String itemInfo; String itemName; String itemPrice; String itemRate; String Dots = ""; static JPanel pnl_tmp; // Panel as a Tab static JLabel lbl_tmp; // label for background static JScrollPane JscrlP_tmp;// ScrollPane for TextArea static JTextArea txtA_tmp; // TextArea to print text in static JLabel lbl_pic1; // lable for menu item image static JLabel lbl_pic2; // ,, ,, ,, ,, ,, static JLabel lbl_pic3; // ,, ,, ,, ,, ,, static JLabel lbl_pic4; // ,, ,, ,, ,, ,, void createPanel() { //Define new tab to hold this tittle & add it to JTabbedPane pnl_tmp = new JPanel(); pnl_tmp.setLayout(null); // setting label for background lbl_tmp = new JLabel(); lbl_tmp.setBackground(new java.awt.Color(255, 255, 255)); lbl_tmp.setForeground(new java.awt.Color(255, 255, 255)); lbl_tmp.setBounds(0, 0, 1216, 788); ************************************************* to be changed lbl_tmp.setIcon(new ImageIcon(getClass().getResource("/restaurant/Pic/MainMenubackground2.png"))); // pnl_tmp.add(lbl_tmp); // Define a JScrollPane to hold JTextarea JscrlP_tmp = new JScrollPane(); JscrlP_tmp.setOpaque(false); JscrlP_tmp.getViewport().setOpaque(false); JscrlP_tmp.setBounds(0, 0, 1210, 780);// ************************************************* to be changed // Define the JTextarea to hold my text (list of menu items in this category ) txtA_tmp = new JTextArea(10, 2); txtA_tmp.setEditable(false); txtA_tmp.setBackground(new Color(0, 0, 0, 0)); txtA_tmp.setForeground(new java.awt.Color(255, 255, 255)); txtA_tmp.setFont(new java.awt.Font("Tempus Sans ITC", 1, 24)); // ************************************************* to be changed // Rockwell Condensed txtA_tmp.setOpaque(false); //to make JscrlP_tmp transparent JscrlP_tmp.setViewportView(txtA_tmp); pnl_tmp.add(JscrlP_tmp); // Setting Menu Items Images as icons of labels (only three Items) lbl_pic1 = new JLabel(); pnl_tmp.add(lbl_pic1); lbl_pic1.setBounds(jLabel1.getBounds()); lbl_pic2 = new JLabel(); pnl_tmp.add(lbl_pic2); lbl_pic2.setBounds(jLabel2.getBounds()); lbl_pic3 = new JLabel(); pnl_tmp.add(lbl_pic3); lbl_pic3.setBounds(jLabel3.getBounds()); lbl_pic4 = new JLabel(); pnl_tmp.add(lbl_pic4); lbl_pic4.setBounds(jLabel7.getBounds()); //set priorty of components in the panel pnl_tmp.setComponentZOrder(lbl_pic1, 0); pnl_tmp.setComponentZOrder(lbl_pic2, 1); pnl_tmp.setComponentZOrder(lbl_pic3, 2); pnl_tmp.setComponentZOrder(lbl_pic4, 3); pnl_tmp.setComponentZOrder(JscrlP_tmp, 4); } void SetPic(String TabTittle) { if ("Drinks".equals(TabTittle)) { lbl_pic1.setIcon(new ImageIcon(getClass().getResource("/restaurant/Pic/Drinks1.png"))); lbl_pic2.setIcon(new ImageIcon(getClass().getResource("/restaurant/Pic/Drinks2.png"))); lbl_pic3.setIcon(new ImageIcon(getClass().getResource("/restaurant/Pic/Drinks3.png"))); lbl_pic4.setIcon(new ImageIcon(getClass().getResource("/restaurant/Pic/Drinks4.png"))); } else if ("Appetizers".equals(TabTittle)) { lbl_pic1.setIcon(new ImageIcon(getClass().getResource("/restaurant/Pic/App1.png"))); lbl_pic2.setIcon(new ImageIcon(getClass().getResource("/restaurant/Pic/App2.png"))); lbl_pic3.setIcon(new ImageIcon(getClass().getResource("/restaurant/Pic/App3.png"))); lbl_pic4.setIcon(new ImageIcon(getClass().getResource("/restaurant/Pic/Burger5.png"))); } else if ("Burger".equals(TabTittle)) { lbl_pic1.setIcon(new ImageIcon(getClass().getResource("/restaurant/Pic/Burger2.png"))); lbl_pic2.setIcon(new ImageIcon(getClass().getResource("/restaurant/Pic/Burger3.png"))); lbl_pic3.setIcon(new ImageIcon(getClass().getResource("/restaurant/Pic/Burger6.png"))); lbl_pic4.setIcon(new ImageIcon(getClass().getResource("/restaurant/Pic/Burger4.png"))); } else if ("Desserts".equals(TabTittle)) { lbl_pic1.setIcon(new ImageIcon(getClass().getResource("/restaurant/Pic/Dess1.png"))); lbl_pic2.setIcon(new ImageIcon(getClass().getResource("/restaurant/Pic/Dess2.png"))); lbl_pic3.setIcon(new ImageIcon(getClass().getResource("/restaurant/Pic/Dess3.png"))); lbl_pic4.setIcon(new ImageIcon(getClass().getResource("/restaurant/Pic/Dess5.png"))); } else if ("Pizza".equals(TabTittle)) { lbl_pic1.setIcon(new ImageIcon(getClass().getResource("/restaurant/Pic/Pizza1.png"))); lbl_pic2.setIcon(new ImageIcon(getClass().getResource("/restaurant/Pic/Pizza2.png"))); lbl_pic3.setIcon(new ImageIcon(getClass().getResource("/restaurant/Pic/Pizza3.png"))); lbl_pic4.setIcon(new ImageIcon(getClass().getResource("/restaurant/Pic/Pizza4.png"))); } else if ("Pasta".equals(TabTittle)) { lbl_pic1.setIcon(new ImageIcon(getClass().getResource("/restaurant/Pic/Pasta1.png"))); lbl_pic2.setIcon(new ImageIcon(getClass().getResource("/restaurant/Pic/Pasta2.png"))); lbl_pic3.setIcon(new ImageIcon(getClass().getResource("/restaurant/Pic/Pasta3.png"))); lbl_pic4.setIcon(new ImageIcon(getClass().getResource("/restaurant/Pic/Pasta4.png"))); } } void showMainMenu() { //remove the initiate tabs tpnl_ViewMainMenu.remove(0); String header = " Dish ................................................................... Price"; MainMenu.categoryList.keySet().forEach((String Category) -> { createPanel(); tpnl_ViewMainMenu.addTab(Category, pnl_tmp); txtA_tmp.append("\n" + header + "\n\n"); // filling this category tab with it's category Items for (int i = 0; i < MainMenu.categoryList.get(Category).size(); ++i) { //filling textarea with required text ( Menu Items : Name + Price + Rate) itemName = " " + MainMenu.categoryList.get(Category).get(i).getItemName() + " "; itemPrice = " " + String.valueOf(MainMenu.categoryList.get(Category).get(i).getItemPrice()); itemRate = " Rate : " String.valueOf(MainMenu.categoryList.get(Category).get(i).getItemRate()) + "/5 \n"; for (int j = itemName.length(); j <= (header.length() - itemPrice.length()); ++j) { Dots += '.'; } itemInfo = itemName + Dots + itemPrice; txtA_tmp.append(itemInfo); txtA_tmp.append(itemRate); //Setting images SetPic(Category); Dots = ""; + } }); //adding offers tab if (!offers.isEmpty()) { createPanel(); tpnl_ViewMainMenu.addTab(" Our Special Offers ", pnl_tmp); for (int i = 0; i < offers.size(); ++i) { txtA_tmp.append("\n " + offers.get(i).getMessage() + " -> "); txtA_tmp.append("Price : "+ offers.get(i).getPrice()+ "\n"); for (int j = 0; j < offers.get(i).getMenuItems().size(); ++j) { txtA_tmp.append(offers.get(i).getMenuItems().get(j).getItemName() +" \n " ); } txtA_tmp.append(" ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~"); } } } public Menu() { initComponents(); showMainMenu(); this.setLocationRelativeTo(null); //center form in screen } @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN- BEGIN:initComponents private void initComponents() { pnl_LogoBar = new javax.swing.JPanel(); lbl_RsturantName = new javax.swing.JLabel(); tpnl_ViewMainMenu = new javax.swing.JTabbedPane(); jPanel2 = new javax.swing.JPanel(); jLabel1 = new javax.swing.JLabel(); jLabel2 = new javax.swing.JLabel(); jLabel3 = new javax.swing.JLabel(); jLabel7 = new javax.swing.JLabel(); setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE); setTitle("Main Menu"); setMaximumSize(new java.awt.Dimension(1216, 788)); setPreferredSize(new java.awt.Dimension(1217, 788)); setSize(new java.awt.Dimension(1217, 788)); pnl_LogoBar.setBackground(new java.awt.Color(255, 213, 0)); lbl_RsturantName.setFont(new java.awt.Font("Rockwell Condensed", 0, 48)); // NOI18N lbl_RsturantName.setForeground(new java.awt.Color(102, 0, 102)); lbl_RsturantName.setText("GUSTO"); javax.swing.GroupLayout pnl_LogoBarLayout = javax.swing.GroupLayout(pnl_LogoBar); pnl_LogoBar.setLayout(pnl_LogoBarLayout); pnl_LogoBarLayout.setHorizontalGroup( pnl_LogoBarLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(pnl_LogoBarLayout.createSequentialGroup() .addGap(530, 530, 530) .addComponent(lbl_RsturantName) .addContainerGap(588, Short.MAX_VALUE)) ); pnl_LogoBarLayout.setVerticalGroup( pnl_LogoBarLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(pnl_LogoBarLayout.createSequentialGroup() .addContainerGap() .addComponent(lbl_RsturantName) new .addContainerGap(16, Short.MAX_VALUE)) ); tpnl_ViewMainMenu.setBackground(new java.awt.Color(255, 213, 0)); tpnl_ViewMainMenu.setForeground(new java.awt.Color(102, 0, 102)); tpnl_ViewMainMenu.setTabLayoutPolicy(javax.swing.JTabbedPane.SCROLL_TAB_LAYOUT); tpnl_ViewMainMenu.setToolTipText(""); tpnl_ViewMainMenu.setAutoscrolls(true); tpnl_ViewMainMenu.setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR)); tpnl_ViewMainMenu.setFont(new java.awt.Font("Rockwell", 3, 24)); // NOI18N tpnl_ViewMainMenu.setName(""); // NOI18N tpnl_ViewMainMenu.setPreferredSize(new java.awt.Dimension(1216, 70)); jLabel1.setBackground(new java.awt.Color(0, 204, 153)); jLabel1.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); jLabel1.setPreferredSize(new java.awt.Dimension(230, 230)); jLabel2.setText("jLabel2"); jLabel2.setPreferredSize(new java.awt.Dimension(230, 230)); jLabel3.setFont(new java.awt.Font("Vladimir Script", 0, 11)); // NOI18N jLabel3.setText("jLabel3"); jLabel3.setPreferredSize(new java.awt.Dimension(230, 230)); jLabel7.setText("jLabel7"); jLabel7.setPreferredSize(new java.awt.Dimension(230, 230)); javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2); jPanel2.setLayout(jPanel2Layout); jPanel2Layout.setHorizontalGroup( jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel2Layout.createSequentialGroup() .addContainerGap(75, Short.MAX_VALUE) .addComponent(jLabel7, javax.swing.GroupLayout.PREFERRED_SIZE, 230, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(61, 61, 61) .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(63, 63, 63) .addComponent(jLabel3, javax.swing.GroupLayout.PREFERRED_SIZE, 230, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(59, 59, 59) .addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addContainerGap()) ); jPanel2Layout.setVerticalGroup( jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel2Layout.createSequentialGroup() .addGap(329, 329, 329) 251, .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jLabel7, javax.swing.GroupLayout.PREFERRED_SIZE, 230, javax.swing.GroupLayout.PREFERRED_SIZE) .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING ) .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 244, javax.swing.GroupLayout.PREFERRED_SIZE) .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE ) .addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, 230, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabel3, javax.swing.GroupLayout.PREFERRED_SIZE, 230, javax.swing.GroupLayout.PREFERRED_SIZE)))) .addContainerGap(63, Short.MAX_VALUE)) ); tpnl_ViewMainMenu.addTab("tab1", jPanel2); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(pnl_LogoBar, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(tpnl_ViewMainMenu, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addComponent(pnl_LogoBar, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(tpnl_ViewMainMenu, javax.swing.GroupLayout.PREFERRED_SIZE, 679, javax.swing.GroupLayout.PREFERRED_SIZE)) ); tpnl_ViewMainMenu.getAccessibleContext().setAccessibleName(""); pack(); }// </editor-fold>//GEN-END:initComponents public static void main(String args[]) { /* Set the Nimbus look and feel */ //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) "> /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel. * For details http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html */ try see { for (javax.swing.UIManager.LookAndFeelInfo info javax.swing.UIManager.getInstalledLookAndFeels()) { if ("Nimbus".equals(info.getName())) { javax.swing.UIManager.setLookAndFeel(info.getClassName()); break; } } } catch (ClassNotFoundException ex) { java.util.logging.Logger.getLogger(Menu.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (InstantiationException ex) { java.util.logging.Logger.getLogger(Menu.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (IllegalAccessException ex) { java.util.logging.Logger.getLogger(Menu.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (javax.swing.UnsupportedLookAndFeelException ex) { : java.util.logging.Logger.getLogger(Menu.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } //</editor-fold> /* Create and display the form */ java.awt.EventQueue.invokeLater(new Runnable() { public void run() { new Menu().setVisible(true); } }); } // Variables declaration - do not modify//GEN-BEGIN:variables public static javax.swing.JLabel jLabel1; public static javax.swing.JLabel jLabel2; public static javax.swing.JLabel jLabel3; public static javax.swing.JLabel jLabel7; private javax.swing.JPanel jPanel2; private javax.swing.JLabel lbl_RsturantName; private javax.swing.JPanel pnl_LogoBar; public static javax.swing.JTabbedPane tpnl_ViewMainMenu; // End of variables declaration//GEN-END:variables } 7. Main Menu: /* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package menuItems; import gustorestaurant.MyConnection; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import java.util.ArrayList; import java.util.HashMap; import java.util.logging.Level; import java.util.logging.Logger; /** * * @author ishik */ public class MainMenu { //Setting Restaurant Name private final String restaurantName = "GUSTO"; private Category category; //Map that contains key String(Category name) and value List of menu item public static HashMap<String, ArrayList<MenuItem>> categoryList = new HashMap<>(); public String getrestaurantName() { return restaurantName; } //Read from database and fill main menu Map public void setCategoryItem() { InventoryItem inventory ; MenuItem menuitem; try { PreparedStatement preparedStmt MyConnection.getConnection().prepareStatement("select * from menu_item"); ResultSet rs = preparedStmt.executeQuery(); // Looping over database rows and get info while (rs.next()) = { /** * Filling object of MenuItem to add it to List of menu items of * Map */ menuitem = new MenuItem(); menuitem.setItemId(rs.getInt("idmenu_item")); menuitem.setItemName(rs.getString("namemenu_item")); menuitem.setItemRate(rs.getInt("rankmenu_item")); menuitem.setItemPrice(rs.getInt("pricemenu_item")); //Checking if Category exists in Map if (!(categoryList.containsKey(rs.getString("category")))) { category = new Category(); category.menuitemlist = new ArrayList<>(); category.setCategory_name(rs.getString("category")); categoryList.put(rs.getString("category"), category.menuitemlist); } categoryList.get(rs.getString("category")).add(menuitem); //Filling object of inventory item to add it to inventoryList(inventory map) inventory = new InventoryItem(); inventory.setMenuItem(menuitem); Inventory.inventoryList.put(rs.getString("namemenu_item"), inventory); } } catch (SQLException ex) { Logger.getLogger(MainMenu.class.getName()).log(Level.SEVERE, null, ex); } } } 8. Inventory Item: /* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package menuItems; /** * * @author ishik */ public class InventoryItem { private int soldMenuItem ; private int avaliableMenuItem; private int numberOfRates; private MenuItem menuItem; //Getters And Setters for attributes of Inventory Item Class public int getNumberOfRates() { return numberOfRates; } public void setNumberOfRates(int numberOfRates) { this.numberOfRates = numberOfRates; } public int getSoldMenuItem() { return soldMenuItem; } public void setSoldMenuItem(int soldMenuItem) { this.soldMenuItem = soldMenuItem; } public void setMenuItem(MenuItem menuItem) { this.menuItem = menuItem; } public MenuItem getMenuItem() { return menuItem; } public int getAvaliableMenuItem() { return avaliableMenuItem; } public void setAvaliableMenuItem(int avaliableMenuItem) { this.avaliableMenuItem = avaliableMenuItem; } } 9. Inventory Form: package menuItems; import menuItems.Menu; import java.awt.Font; import java.sql.*; import java.util.logging.Level; import java.util.logging.Logger; import javax.swing.JOptionPane; import javax.swing.table.DefaultTableModel; import managerPackage.Manager; import managerPackage.ManagerAnnouncementsForm; import managerPackage.ManagerWelcomeForm; import starting.HomepageForm; /** * * @author ishik */ public class InventoryForm extends javax.swing.JFrame { /** * Creates new form InventoryForm */ //HashMap<String, Double > orderMap = new HashMap<String,Double>(); //reem String choice; public static DefaultTableModel model; Manager manager; //to access inventory items public InventoryForm() throws SQLException { initComponents(); initializeComp(); } public InventoryForm(Manager m) throws SQLException { initComponents(); this.manager = m; initializeComp(); } private void initializeComp() { this.setLocationRelativeTo(null); //center form in screen // inventory.rateItem(orderMap); model = (DefaultTableModel) tbl_viewItems.getModel(); tbl_viewItems.setVisible(false); tbl_viewItems.getTableHeader().setFont(new Font("Rockwell", Font.BOLD, 20)); } /** * This method is called from within the constructor to initialize the form. * WARNING: Do NOT modify this code. The content of this method is always * regenerated by the Form Editor. */ @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" BEGIN:initComponents private void initComponents() { pnl_bg = new javax.swing.JPanel(); btn_addItem = new javax.swing.JButton(); btn_DeleteItem = new javax.swing.JButton(); txt_itemQuantity = new javax.swing.JTextField(); lbl_itemQuantity = new javax.swing.JLabel(); lbl_deleteItemId = new javax.swing.JLabel(); txt_deleteitemid = new javax.swing.JTextField(); desc="Generated Code">//GEN- txt_itemPrice = new javax.swing.JTextField(); lbl_itemPrice = new javax.swing.JLabel(); jLabel2 = new javax.swing.JLabel(); txt_itemName = new javax.swing.JTextField(); lbl_itemName = new javax.swing.JLabel(); jLabel1 = new javax.swing.JLabel(); cbx_viewitem = new javax.swing.JComboBox<String>(); jScrollPane1 = new javax.swing.JScrollPane(); tbl_viewItems = new javax.swing.JTable(); lbl_bg = new javax.swing.JLabel(); pHeader = new javax.swing.JPanel(); btnLogout = new javax.swing.JButton(); lbLogo = new javax.swing.JLabel(); btnInventoryManager = new javax.swing.JButton(); btnMakeAnnouncement = new javax.swing.JButton(); btnMenuManager = new javax.swing.JButton(); setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); setUndecorated(true); pnl_bg.setLayout(null); btn_addItem.setFont(new java.awt.Font("Rockwell", 1, 24)); // NOI18N btn_addItem.setForeground(new java.awt.Color(102, 0, 102)); btn_addItem.setText("Add "); btn_addItem.setPreferredSize(new java.awt.Dimension(169, 37)); btn_addItem.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btn_addItemActionPerformed(evt); } }); pnl_bg.add(btn_addItem); btn_addItem.setBounds(240, 730, 150, 40); btn_DeleteItem.setFont(new java.awt.Font("Rockwell", 1, 24)); // NOI18N btn_DeleteItem.setForeground(new java.awt.Color(102, 0, 102)); btn_DeleteItem.setText("Delete"); btn_DeleteItem.setPreferredSize(new java.awt.Dimension(169, 37)); btn_DeleteItem.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btn_DeleteItemActionPerformed(evt); } }); pnl_bg.add(btn_DeleteItem); btn_DeleteItem.setBounds(770, 730, 191, 40); pnl_bg.add(txt_itemQuantity); txt_itemQuantity.setBounds(350, 670, 200, 30); lbl_itemQuantity.setFont(new java.awt.Font("Rockwell", 0, 28)); // NOI18N lbl_itemQuantity.setForeground(new java.awt.Color(255, 255, 255)); lbl_itemQuantity.setText("Enter Item Quantity"); pnl_bg.add(lbl_itemQuantity); lbl_itemQuantity.setBounds(70, 670, 260, 34); lbl_deleteItemId.setFont(new java.awt.Font("Rockwell", 0, 28)); // NOI18N lbl_deleteItemId.setForeground(new java.awt.Color(255, 255, 255)); lbl_deleteItemId.setText("Enter Item ID"); pnl_bg.add(lbl_deleteItemId); lbl_deleteItemId.setBounds(670, 600, 180, 34); txt_deleteitemid.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { txt_deleteitemidActionPerformed(evt); } }); pnl_bg.add(txt_deleteitemid); txt_deleteitemid.setBounds(880, 600, 200, 30); pnl_bg.add(txt_itemPrice); txt_itemPrice.setBounds(350, 600, 200, 30); lbl_itemPrice.setFont(new java.awt.Font("Rockwell", 0, 28)); // NOI18N lbl_itemPrice.setForeground(new java.awt.Color(255, 255, 255)); lbl_itemPrice.setText("Enter Item Price"); pnl_bg.add(lbl_itemPrice); lbl_itemPrice.setBounds(80, 600, 220, 34); jLabel2.setFont(new java.awt.Font("Rockwell", 1, 30)); // NOI18N jLabel2.setForeground(new java.awt.Color(255, 255, 255)); jLabel2.setText("Delete Item"); pnl_bg.add(jLabel2); jLabel2.setBounds(780, 460, 210, 36); pnl_bg.add(txt_itemName); txt_itemName.setBounds(350, 530, 200, 30); lbl_itemName.setFont(new java.awt.Font("Rockwell", 0, 28)); // NOI18N lbl_itemName.setForeground(new java.awt.Color(255, 255, 255)); lbl_itemName.setText("Enter Item Name"); pnl_bg.add(lbl_itemName); lbl_itemName.setBounds(80, 520, 230, 40); jLabel1.setFont(new java.awt.Font("Rockwell", 1, 30)); // NOI18N jLabel1.setForeground(new java.awt.Color(255, 255, 255)); jLabel1.setText(" Add Item"); pnl_bg.add(jLabel1); jLabel1.setBounds(172, 460, 220, 40); cbx_viewitem.setFont(new java.awt.Font("Rockwell", 1, 24)); // NOI18N cbx_viewitem.setForeground(new java.awt.Color(102, 0, 102)); cbx_viewitem.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Choose your Category", "Appetizers", "Pasta", "Burger", "Pizza", "Drinks", "Desserts" })); cbx_viewitem.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { cbx_viewitemActionPerformed(evt); } }); pnl_bg.add(cbx_viewitem); cbx_viewitem.setBounds(410, 160, 386, 35); tbl_viewItems.setFont(new java.awt.Font("Rockwell", 0, 18)); // NOI18N tbl_viewItems.setModel(new javax.swing.table.DefaultTableModel( new Object [][] { }, new String [] { "Item ID", "Item Name", "Item Rank", "Units Sold", "Quantity Avaliable" } ) { boolean[] canEdit = new boolean [] { false, false, false, false, false }; public boolean isCellEditable(int rowIndex, int columnIndex) { return canEdit [columnIndex]; } }); tbl_viewItems.setGridColor(new java.awt.Color(255, 255, 255)); tbl_viewItems.setOpaque(false); jScrollPane1.setViewportView(tbl_viewItems); if (tbl_viewItems.getColumnModel().getColumnCount() > 0) { tbl_viewItems.getColumnModel().getColumn(0).setMinWidth(90); tbl_viewItems.getColumnModel().getColumn(0).setMaxWidth(120); tbl_viewItems.getColumnModel().getColumn(1).setMinWidth(270); tbl_viewItems.getColumnModel().getColumn(1).setMaxWidth(280); tbl_viewItems.getColumnModel().getColumn(2).setMinWidth(120); tbl_viewItems.getColumnModel().getColumn(2).setMaxWidth(150); tbl_viewItems.getColumnModel().getColumn(3).setMinWidth(100); tbl_viewItems.getColumnModel().getColumn(3).setMaxWidth(150); tbl_viewItems.getColumnModel().getColumn(4).setMinWidth(150); tbl_viewItems.getColumnModel().getColumn(4).setMaxWidth(200); } pnl_bg.add(jScrollPane1); jScrollPane1.setBounds(130, 220, 896, 200); lbl_bg.setIcon(new javax.swing.ImageIcon(getClass().getResource("/menuItems/Food- Inventory-Management-What-It-Is-and-How-to-Do-It-Well-1.jpg"))); // NOI18N lbl_bg.setText("jLabel1"); pnl_bg.add(lbl_bg); lbl_bg.setBounds(0, 80, 1220, 710); pHeader.setBackground(new java.awt.Color(255, 213, 0)); pHeader.setName("pHeader"); // NOI18N pHeader.setPreferredSize(new java.awt.Dimension(1062, 70)); pHeader.setLayout(null); btnLogout.setBackground(new java.awt.Color(255, 213, 0)); btnLogout.setFont(new java.awt.Font("Rockwell", 0, 24)); // NOI18N btnLogout.setForeground(new java.awt.Color(127, 72, 101)); btnLogout.setText("Log out"); btnLogout.setToolTipText(""); btnLogout.setBorder(null); btnLogout.setBorderPainted(false); btnLogout.setContentAreaFilled(false); btnLogout.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR)); btnLogout.setName(""); // NOI18N btnLogout.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnLogoutActionPerformed(evt); } }); pHeader.add(btnLogout); btnLogout.setBounds(1090, 30, 101, 29); lbLogo.setBackground(new java.awt.Color(255, 255, 255)); lbLogo.setFont(new java.awt.Font("Rockwell Condensed", 0, 52)); // NOI18N lbLogo.setForeground(new java.awt.Color(127, 72, 101)); lbLogo.setText("GUSTO"); lbLogo.setToolTipText(""); pHeader.add(lbLogo); lbLogo.setBounds(40, 10, 120, 62); btnInventoryManager.setBackground(new java.awt.Color(255, 213, 0)); btnInventoryManager.setFont(new java.awt.Font("Rockwell", 0, 24)); // NOI18N btnInventoryManager.setForeground(new java.awt.Color(127, 72, 101)); btnInventoryManager.setText("Track Inventory"); btnInventoryManager.setBorder(null); btnInventoryManager.setBorderPainted(false); btnInventoryManager.setContentAreaFilled(false); btnInventoryManager.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR)); btnInventoryManager.setPreferredSize(new java.awt.Dimension(87, 29)); btnInventoryManager.setRequestFocusEnabled(false); btnInventoryManager.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnInventoryManagerActionPerformed(evt); } }); pHeader.add(btnInventoryManager); btnInventoryManager.setBounds(900, 30, 184, 29); btnMakeAnnouncement.setBackground(new java.awt.Color(255, 213, 0)); btnMakeAnnouncement.setFont(new java.awt.Font("Rockwell", 0, 24)); // NOI18N btnMakeAnnouncement.setForeground(new java.awt.Color(127, 72, 101)); btnMakeAnnouncement.setText("Make Announcement"); btnMakeAnnouncement.setBorder(null); btnMakeAnnouncement.setBorderPainted(false); btnMakeAnnouncement.setContentAreaFilled(false); btnMakeAnnouncement.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR)); btnMakeAnnouncement.setPreferredSize(new java.awt.Dimension(87, 29)); btnMakeAnnouncement.setRequestFocusEnabled(false); btnMakeAnnouncement.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnMakeAnnouncementActionPerformed(evt); } }); pHeader.add(btnMakeAnnouncement); btnMakeAnnouncement.setBounds(630, 30, 255, 29); btnMenuManager.setBackground(new java.awt.Color(255, 213, 0)); btnMenuManager.setFont(new java.awt.Font("Rockwell", 0, 24)); // NOI18N btnMenuManager.setForeground(new java.awt.Color(127, 72, 101)); btnMenuManager.setText("Main Menu"); btnMenuManager.setBorder(null); btnMenuManager.setBorderPainted(false); btnMenuManager.setContentAreaFilled(false); btnMenuManager.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR)); btnMenuManager.setPreferredSize(new java.awt.Dimension(87, 29)); btnMenuManager.setRequestFocusEnabled(false); btnMenuManager.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnMenuManagerActionPerformed(evt); } }); pHeader.add(btnMenuManager); btnMenuManager.setBounds(470, 30, 153, 29); pnl_bg.add(pHeader); pHeader.setBounds(0, 0, 1220, 80); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(pnl_bg, Short.MAX_VALUE) javax.swing.GroupLayout.DEFAULT_SIZE, 1216, ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(pnl_bg, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 788, Short.MAX_VALUE) ); pack(); }// </editor-fold>//GEN-END:initComponents private void cbx_viewitemActionPerformed(java.awt.event.ActionEvent evt) {//GENFIRST:event_cbx_viewitemActionPerformed // TODO add your handling code here: tbl_viewItems.setVisible(true); //Clear table rows model.setRowCount(0); //Get choosen category from combobox choice = (String) cbx_viewitem.getSelectedItem(); //Calling function to diplay items on table manager.viewInventoryItem(choice); }//GEN-LAST:event_cbx_viewitemActionPerformed private void btn_addItemActionPerformed(java.awt.event.ActionEvent FIRST:event_btn_addItemActionPerformed // TODO add your handling code here: evt) {//GEN- if ((txt_itemName.getText().isEmpty()) || (txt_itemPrice.getText().isEmpty()) (cbx_viewitem.getSelectedItem().toString().isEmpty()) || || (txt_itemQuantity.getText().isEmpty())) { JOptionPane.showMessageDialog(null, "Pls provide valid all fields"); } else { //Calling function to add new item in database and new row in table System.out.println(txt_itemName.getText()); manager.addInventoryItem(txt_itemName.getText(), Integer.valueOf(txt_itemPrice.getText()), cbx_viewitem.getSelectedItem().toString(), Integer.valueOf(txt_itemQuantity.getText())); //clear all text fields txt_itemName.setText(""); txt_itemPrice.setText(""); txt_itemQuantity.setText(""); } }//GEN-LAST:event_btn_addItemActionPerformed private void btn_DeleteItemActionPerformed(java.awt.event.ActionEvent evt) {//GENFIRST:event_btn_DeleteItemActionPerformed //Calling function to delete item from database and remove item row from table if (txt_deleteitemid.getText().isEmpty()) { JOptionPane.showMessageDialog(null, "Please fill all text fields"); } else { int itemId = Integer.valueOf(txt_deleteitemid.getText()); Boolean found = false; for(int i=0; i<MainMenu.categoryList.get(choice).size(); ++i) { if(MainMenu.categoryList.get(choice).get(i).getItemId()==itemId) { manager.deleteInventoryItem(itemId, choice); found=true; break; } } if(!found) { JOptionPane.showMessageDialog(null, "This item id doesn't exist"); } } //clear text field txt_deleteitemid.setText(""); }//GEN-LAST:event_btn_DeleteItemActionPerformed private void btnLogoutActionPerformed(java.awt.event.ActionEvent evt)//GEN- FIRST:event_btnLogoutActionPerformed {//GEN-HEADEREND:event_btnLogoutActionPerformed HomepageForm homepage = new HomepageForm(); homepage.setVisible(true); this.dispose(); }//GEN-LAST:event_btnLogoutActionPerformed private void btnInventoryManagerActionPerformed(java.awt.event.ActionEvent evt)//GENFIRST:event_btnInventoryManagerActionPerformed {//GEN-HEADEREND:event_btnInventoryManagerActionPerformed // TODO add your handling code here: }//GEN-LAST:event_btnInventoryManagerActionPerformed private void btnMakeAnnouncementActionPerformed(java.awt.event.ActionEvent evt)//GEN-FIRST:event_btnMakeAnnouncementActionPerformed {//GEN-HEADEREND:event_btnMakeAnnouncementActionPerformed // TODO add your handling code here: try { // TODO add your handling code here: ManagerAnnouncementsForm ann = new ManagerAnnouncementsForm(manager); ann.setVisible(true); this.dispose(); } catch (SQLException ex) { Logger.getLogger(ManagerWelcomeForm.class.getName()).log(Level.SEVERE, null, ex); } }//GEN-LAST:event_btnMakeAnnouncementActionPerformed private void btnMenuManagerActionPerformed(java.awt.event.ActionEvent evt)//GENFIRST:event_btnMenuManagerActionPerformed {//GEN-HEADEREND:event_btnMenuManagerActionPerformed // TODO add your handling code here: Menu m=new Menu(); m.setVisible(true); this.dispose(); }//GEN-LAST:event_btnMenuManagerActionPerformed private void txt_deleteitemidActionPerformed(java.awt.event.ActionEvent evt)//GENFIRST:event_txt_deleteitemidActionPerformed {//GEN-HEADEREND:event_txt_deleteitemidActionPerformed // TODO add your handling code here: }//GEN-LAST:event_txt_deleteitemidActionPerformed /** * @param args the command line arguments */ public static void main(String args[]) { /* Set the Nimbus look and feel */ //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) "> /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel. * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html */ try { for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) { if ("Nimbus".equals(info.getName())) { javax.swing.UIManager.setLookAndFeel(info.getClassName()); break; } } } catch (ClassNotFoundException ex) { java.util.logging.Logger.getLogger(InventoryForm.class.getName()).log(java.util.logging.Level. SEVERE, null, ex); } catch (InstantiationException ex) { java.util.logging.Logger.getLogger(InventoryForm.class.getName()).log(java.util.logging.Level. SEVERE, null, ex); } catch (IllegalAccessException ex) { java.util.logging.Logger.getLogger(InventoryForm.class.getName()).log(java.util.logging.Level. SEVERE, null, ex); } catch (javax.swing.UnsupportedLookAndFeelException ex) { java.util.logging.Logger.getLogger(InventoryForm.class.getName()).log(java.util.logging.Level. SEVERE, null, ex); } //</editor-fold> /* Create and display the form */ java.awt.EventQueue.invokeLater(new Runnable() { public void run() { try { new InventoryForm().setVisible(true); } catch (SQLException ex) { Logger.getLogger(InventoryForm.class.getName()).log(Level.SEVERE, null, ex); } } }); } // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JButton btnInventoryManager; private javax.swing.JButton btnLogout; private javax.swing.JButton btnMakeAnnouncement; private javax.swing.JButton btnMenuManager; private javax.swing.JButton btn_DeleteItem; private javax.swing.JButton btn_addItem; private javax.swing.JComboBox<String> cbx_viewitem; private javax.swing.JLabel jLabel1; private javax.swing.JLabel jLabel2; private javax.swing.JScrollPane jScrollPane1; private javax.swing.JLabel lbLogo; private javax.swing.JLabel lbl_bg; private javax.swing.JLabel lbl_deleteItemId; private javax.swing.JLabel lbl_itemName; private javax.swing.JLabel lbl_itemPrice; private javax.swing.JLabel lbl_itemQuantity; public static javax.swing.JPanel pHeader; private javax.swing.JPanel pnl_bg; public static javax.swing.JTable tbl_viewItems; private javax.swing.JTextField txt_deleteitemid; private javax.swing.JTextField txt_itemName; private javax.swing.JTextField txt_itemPrice; private javax.swing.JTextField txt_itemQuantity; // End of variables declaration//GEN-END:variables } 10. Inventory: package menuItems; import gustorestaurant.MyConnection; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import java.util.ArrayList; import java.util.HashMap; import java.util.Map; import java.util.logging.Level; import java.util.logging.Logger; /** * * @author ishik */ public class Inventory { private double newRate, rate; private int numberOfRates; /** * */ //Map that contains Inventory List with menu item name as a key and value inventory item public static HashMap<String, InventoryItem> inventoryList = new HashMap<String, InventoryItem>(); //variables for calculating new rate of menu item public void setInventoryItems() { try { //Reading Inventory info from inventory table in database PreparedStatement preparedStmt = MyConnection.getConnection().prepareStatement("select * from inventory"); ResultSet rs = preparedStmt.executeQuery(); try { //Getting All Rows in Database from inventory table while (rs.next()) { //looping over inventoryList map to add inventory info with id read from database inventoryList.keySet().forEach((itemName) -> { try { if rs.getInt("item_id")) { (inventoryList.get(itemName).getMenuItem().getItemId() == inventoryList.get(itemName).setAvaliableMenuItem(rs.getInt("avaliable_quantity")); inventoryList.get(itemName).setSoldMenuItem(rs.getInt("units_sold")); inventoryList.get(itemName).setNumberOfRates(rs.getInt("number_rate")); } } catch (SQLException ex) { Logger.getLogger(Inventory.class.getName()).log(Level.SEVERE, null, ex); } }); } } catch (SQLException ex) { Logger.getLogger(Inventory.class.getName()).log(Level.SEVERE, null, ex); } } catch (SQLException ex) { Logger.getLogger(Inventory.class.getName()).log(Level.SEVERE, null, ex); } } public void rateItem(Map<String, Double> rateMap) { //looping over rateMap and get rate of item and updating rate rateMap.keySet().forEach((itemName) -> { numberOfRates = inventoryList.get(itemName).getNumberOfRates(); rate = inventoryList.get(itemName).getMenuItem().getItemRate(); //Setting new rate if (numberOfRates == 0) { newRate = rateMap.get(itemName); } else { newRate = (rate + rateMap.get(itemName)) / numberOfRates; } //Rounding rate to two decimal places newRate = Math.round(newRate * 10.0) / 10.0; //Update new rate in main menu map inventoryList.get(itemName).getMenuItem().setItemRate(newRate); //Update new rate in menu item table in database try { String query = "UPDATE menu_item SET rankmenu_item = " + newRate + " WHERE idmenu_item = " + inventoryList.get(itemName).getMenuItem().getItemId(); PreparedStatement preparedStmt MyConnection.getConnection().prepareStatement(query); preparedStmt.execute(); } catch (SQLException ex) { Logger.getLogger(Inventory.class.getName()).log(Level.SEVERE, null, ex); } }); } } 11. Category: /* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package menuItems; import java.util.ArrayList; /** * * @author ishik */ public class Category { = private String category_name; //List of menu items for every category protected ArrayList<MenuItem>menuitemlist; //Getters and Setters for attributes public void setCategory_name(String category_name) { this.category_name = category_name; } public void setMenuItemList(MenuItem menuItem) { menuitemlist.add(menuItem); } public ArrayList<MenuItem> getMenuitemlist() { return menuitemlist; } public String getCategory_name() { return category_name; } } 11. Manager: /* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package managerPackage; import customerPackage.Waiter; import gustorestaurant.MyConnection; import gustorestaurant.User; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import java.util.logging.Level; import java.util.logging.Logger; import javax.swing.JOptionPane; import menuItems.Inventory; import menuItems.InventoryForm; import menuItems.InventoryItem; import menuItems.MainMenu; import menuItems.MenuItem; import starting.HomepageForm; import starting.LoginForm; import starting.SignUpForm; /** * * @author ishik */ public class Manager extends User { public Manager(String name, String username, String mobilePhone, String password) { super(name, username, mobilePhone, password); } public Manager() { } public String getName() { return name; } void addWaiter(Waiter waiter) { try { String Query = "INSERT INTO menu_items.waiters (id_waiters ,name_waiters ,start_time_waiters,finish_time_waiters ,status_waiters ,orderList_waiters)" + " VALUES (?,?,?,?,?,?,?)"; PreparedStatement preparedStmt = MyConnection.getConnection().prepareStatement(Query); preparedStmt.setString(1, waiter.getId()); preparedStmt.setString(2, waiter.getName()); preparedStmt.setString(3, String.valueOf(waiter.getStart())); preparedStmt.setString(4, String.valueOf(waiter.getEnd())); preparedStmt.setInt(5, 1); preparedStmt.setString(6, null); preparedStmt.setString(7, null); preparedStmt.execute(); } catch (SQLException ex) { Logger.getLogger(Manager.class.getName()).log(Level.SEVERE, null, ex); } } public void addInventoryItem(String itemName, int itemPrice, String CategoryName, int avaliable_quantity) { Boolean itemFound = false; String query; // Database Query int itemID = 0; //variable to set id for item MenuItem menuitem = new MenuItem(); InventoryItem inventory = new InventoryItem(); //To Check if menu item already exists if (!itemFound) { try { //Add new added item into database in menu_item table query = "INSERT INTO menu_item ( idmenu_item, namemenu_item,rankmenu_item , pricemenu_item , category )" + " VALUES(?,?,?,?,?)"; PreparedStatement preparedStmt MyConnection.getConnection().prepareStatement(query); //Set random itemID itemID = Inventory.inventoryList.size() + 1; preparedStmt.setInt(1, itemID); preparedStmt.setString(2, itemName); preparedStmt.setInt(3, 0); preparedStmt.setInt(4, itemPrice); preparedStmt.setString(5, CategoryName); if (preparedStmt.executeUpdate() > 0) { JOptionPane.showMessageDialog(null, "New item is added "); //To add new addded item to my main menu map menuitem.setItemId(itemID); menuitem.setItemName(itemName); menuitem.setItemPrice(itemPrice); menuitem.setItemRate(0); = // MainMenu.categoryList.get(CategoryName).add(menuitem); //To display new added item info on table InventoryForm.model.addRow(new Object[] { itemID, itemName, 0, 0, avaliable_quantity }); } } catch (SQLException ex) { Logger.getLogger(Manager.class.getName()).log(Level.SEVERE, null, ex); } try { //Add new inventory info in database in inventory table query = "INSERT INTO inventory ( item_id , available_quantity, units_sold , number_rate)" + " VALUES(?,?,?,?)"; PreparedStatement preparedStmt MyConnection.getConnection().prepareStatement(query); preparedStmt.setInt(1, itemID); preparedStmt.setInt(3, 0); preparedStmt.setInt(2, avaliable_quantity); preparedStmt.setInt(4, 0); preparedStmt.execute(); //To add new added item in inventory List = inventory.setMenuItem(menuitem); inventory.setAvaliableMenuItem(avaliable_quantity); inventory.setSoldMenuItem(0); Inventory.inventoryList.put(menuitem.getItemName(), inventory); } catch (SQLException ex) { Logger.getLogger(Manager.class.getName()).log(Level.SEVERE, null, ex); } } for (int i = 0; i < MainMenu.categoryList.get(CategoryName).size(); ++i) { if (MainMenu.categoryList.get(CategoryName).get(i).getItemName().equals(itemName)) { JOptionPane.showMessageDialog(null, "This Item already exists"); itemFound = true; break; } } } public void viewInventoryItem(String categoryName) { String itemName; try { //Looping over categoryList(main menu map) to display List of menuItem and inventoryItem of choosen category on table for (int i = 0; i < MainMenu.categoryList.get(categoryName).size(); ++i) { //getting item name to get inventory info from inventoryList map with itemNam(key of map) itemName = MainMenu.categoryList.get(categoryName).get(i).getItemName(); //Getting Inventory Info from Inventory List And Display it on table //Getting from categoryList(main menu map) menuItemID,menuItemName,menuItemRate //Getting from inventoryList(inventory map) inventoryItemUnits_sold, inventoryItemAvaliable_Quantity //Displaying info on table InventoryForm.model.addRow(new Object[] { MainMenu.categoryList.get(categoryName).get(i).getItemId(), MainMenu.categoryList.get(categoryName).get(i).getItemName(), MainMenu.categoryList.get(categoryName).get(i).getItemRate(), Inventory.inventoryList.get(itemName).getSoldMenuItem(), Inventory.inventoryList.get(MainMenu.categoryList.get(categoryName).get(i).getItemName() ).getAvaliableMenuItem() }); } } catch (Exception e) { JOptionPane.showMessageDialog(null, "No Item Found"); } } public void deleteInventoryItem(int deleteId, String categoryName) { try { //Delete Menu Item from menu item table in database String query = "delete from menu_item where idmenu_item = ? "; PreparedStatement preparedStmt = MyConnection.getConnection().prepareStatement(query); preparedStmt.setInt(1, deleteId); if (preparedStmt.executeUpdate() > 0) { JOptionPane.showMessageDialog(null, "Item Deleted"); //Search in categoryList(main menu map) for deleteItemID to delete it from map //After getting name of deleteItem from categoryList delete it inventoryList(inventory map) for (int i = 0; i < MainMenu.categoryList.get(categoryName).size(); ++i) { if (MainMenu.categoryList.get(categoryName).get(i).getItemId() == deleteId) from { //getting name of item from categoryList String iname = MainMenu.categoryList.get(categoryName).get(i).getItemName(); //Remove menu item from main menu map (main menu map) MenuItem removedMenuItem = new MenuItem(); removedMenuItem = MainMenu.categoryList.get(categoryName).remove(i); //Remove Inventory item from inventory list map InventoryItem removedInventoryItem = new InventoryItem(); if (Inventory.inventoryList.containsKey(iname)) { removedInventoryItem = Inventory.inventoryList.remove(iname); } //Delete item row from table InventoryForm.model.removeRow(i); break; } } } } catch (SQLException ex) { Logger.getLogger(Manager.class.getName()).log(Level.SEVERE, null, ex); } try { //Delete Inventory Item from inventory table in database String query = "delete from inventory where item_id= ? "; PreparedStatement preparedStmt = MyConnection.getConnection().prepareStatement(query); preparedStmt.setInt(1, deleteId); preparedStmt.execute(); } catch (SQLException ex) { Logger.getLogger(Manager.class.getName()).log(Level.SEVERE, null, ex); } } public void addAnnouncement(Announcement a) { HomepageForm.offers.add(a); String items = convertItemstoString(a.menuItems); PreparedStatement ps; String query = "INSERT INTO `announcements`(`managerName`, `message`, `menuItems`, `price`) VALUES (?,?,?,?)"; try { ps = MyConnection.getConnection().prepareStatement(query); ps.setString(1, this.name); ps.setString(2, a.message); ps.setString(3, items); ps.setInt(4, a.price); boolean execute = ps.execute(); } catch (SQLException ex) { Logger.getLogger(Manager.class.getName()).log(Level.SEVERE, null, ex); } } //manage delievery boys @Override public boolean register() { boolean registered = false; PreparedStatement ps; ResultSet rs; String query = "SELECT * FROM manager WHERE manager_username =?"; try { ps = MyConnection.getConnection().prepareStatement(query); ps.setString(1, this.userName); rs = ps.executeQuery(); if (rs.next()) { JOptionPane.showMessageDialog(null, "This Username Already Exists"); SignUpForm.setTextField(); } else { query = "INSERT INTO `manager`(`manager_username`, `manager_mobile`, `manager_password`, `manager_name`) VALUES (?,?,?,?)"; ps = MyConnection.getConnection().prepareStatement(query); String encrypted = User.encryptThisString(this.password); this.password = encrypted; ps.setString(1, this.userName); ps.setLong(2, Long.parseLong(this.mobilePhone)); ps.setString(3, this.password); ps.setString(4, this.name); if (ps.executeUpdate() > 0) { //JOptionPane.showMessageDialog(null, "New User Add"); Manager m = new Manager(this.name, this.userName, this.mobilePhone, this.password); ManagerWelcomeForm mf = new ManagerWelcomeForm(m); mf.setVisible(true); } } } catch (SQLException ex) { Logger.getLogger(Manager.class.getName()).log(Level.SEVERE, null, ex); } return registered; } /** * * @param muserName * @param mPassword * @return */ @Override public boolean login(String muserName, String mPassword) { boolean loggedIn = false; PreparedStatement ps; ResultSet rs; String query = "SELECT * FROM manager WHERE manager_username=? AND manager_password=?"; try { String encrypted = User.encryptThisString(mPassword); ps = MyConnection.getConnection().prepareStatement(query); ps.setString(1, muserName); ps.setString(2, encrypted); rs = ps.executeQuery(); if (rs.next()) { String mphone = rs.getString("manager_mobile"); String mname = rs.getString("manager_name"); Manager m = new Manager(mname, muserName, mphone, mPassword); ManagerWelcomeForm mf = new ManagerWelcomeForm(m); mf.setVisible(true); loggedIn = true; } else { LoginForm.setTextFields(); JOptionPane.showMessageDialog(null, "Username or password incorrect.", "Login Failed", JOptionPane.ERROR_MESSAGE); } } catch (SQLException ex) { System.out.println("fail"); Logger.getLogger(Manager.class.getName()).log(Level.SEVERE, null, ex); } return loggedIn; } } 12. Manager WelcomeForm: /* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package managerPackage; import menuItems.Menu; import java.sql.SQLException; import java.util.logging.Level; import java.util.logging.Logger; import menuItems.InventoryForm; import menuItems.MainMenu; import starting.HomepageForm; /** * * @author ishik */ public class ManagerWelcomeForm extends javax.swing.JFrame { Manager manager; /** * Creates new form ManagerWelcomeForm */ public ManagerWelcomeForm() { initComponents(); this.setLocationRelativeTo(null); //center form in screen } public ManagerWelcomeForm(Manager m) { initComponents(); this.setLocationRelativeTo(null); //center form in screen this.manager = m; String[] name = m.getName().split(" "); lblWelcome.setText("Welcome " + name[0] + ","); } /** * This method is called from within the constructor to initialize the form. * WARNING: Do NOT modify this code. The content of this method is always * regenerated by the Form Editor. */ @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated BEGIN:initComponents private void initComponents() { pHeader = new javax.swing.JPanel(); btnLogout = new javax.swing.JButton(); lbLogo = new javax.swing.JLabel(); btnInventoryManager = new javax.swing.JButton(); btnMakeAnnouncement = new javax.swing.JButton(); Code">//GEN- btnMenuManager = new javax.swing.JButton(); pnlWelcomeMang = new javax.swing.JPanel(); lblmessage = new javax.swing.JLabel(); lblWelcome = new javax.swing.JLabel(); lblImage = new javax.swing.JLabel(); setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); setMinimumSize(new java.awt.Dimension(1217, 871)); setUndecorated(true); getContentPane().setLayout(null); pHeader.setBackground(new java.awt.Color(255, 213, 0)); pHeader.setName("pHeader"); // NOI18N pHeader.setPreferredSize(new java.awt.Dimension(1062, 70)); pHeader.setLayout(null); btnLogout.setBackground(new java.awt.Color(255, 213, 0)); btnLogout.setFont(new java.awt.Font("Rockwell", 0, 24)); // NOI18N btnLogout.setForeground(new java.awt.Color(127, 72, 101)); btnLogout.setText("Log out"); btnLogout.setToolTipText(""); btnLogout.setBorder(null); btnLogout.setBorderPainted(false); btnLogout.setContentAreaFilled(false); btnLogout.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR)); btnLogout.setName(""); // NOI18N btnLogout.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnLogoutActionPerformed(evt); } }); pHeader.add(btnLogout); btnLogout.setBounds(1103, 26, 101, 29); lbLogo.setBackground(new java.awt.Color(255, 255, 255)); lbLogo.setFont(new java.awt.Font("Rockwell Condensed", 0, 52)); // NOI18N lbLogo.setForeground(new java.awt.Color(127, 72, 101)); lbLogo.setText("GUSTO"); lbLogo.setToolTipText(""); pHeader.add(lbLogo); lbLogo.setBounds(43, 0, 120, 62); btnInventoryManager.setBackground(new java.awt.Color(255, 213, 0)); btnInventoryManager.setFont(new java.awt.Font("Rockwell", 0, 24)); // NOI18N btnInventoryManager.setForeground(new java.awt.Color(127, 72, 101)); btnInventoryManager.setText("Track Inventory"); btnInventoryManager.setBorder(null); btnInventoryManager.setBorderPainted(false); btnInventoryManager.setContentAreaFilled(false); btnInventoryManager.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR)); btnInventoryManager.setPreferredSize(new java.awt.Dimension(87, 29)); btnInventoryManager.setRequestFocusEnabled(false); btnInventoryManager.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnInventoryManagerActionPerformed(evt); } }); pHeader.add(btnInventoryManager); btnInventoryManager.setBounds(900, 30, 184, 29); btnMakeAnnouncement.setBackground(new java.awt.Color(255, 213, 0)); btnMakeAnnouncement.setFont(new java.awt.Font("Rockwell", 0, 24)); // NOI18N btnMakeAnnouncement.setForeground(new java.awt.Color(127, 72, 101)); btnMakeAnnouncement.setText("Make Announcement"); btnMakeAnnouncement.setBorder(null); btnMakeAnnouncement.setBorderPainted(false); btnMakeAnnouncement.setContentAreaFilled(false); btnMakeAnnouncement.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR)); btnMakeAnnouncement.setPreferredSize(new java.awt.Dimension(87, 29)); btnMakeAnnouncement.setRequestFocusEnabled(false); btnMakeAnnouncement.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnMakeAnnouncementActionPerformed(evt); } }); pHeader.add(btnMakeAnnouncement); btnMakeAnnouncement.setBounds(620, 30, 255, 29); btnMenuManager.setBackground(new java.awt.Color(255, 213, 0)); btnMenuManager.setFont(new java.awt.Font("Rockwell", 0, 24)); // NOI18N btnMenuManager.setForeground(new java.awt.Color(127, 72, 101)); btnMenuManager.setText("Main Menu"); btnMenuManager.setBorder(null); btnMenuManager.setBorderPainted(false); btnMenuManager.setContentAreaFilled(false); btnMenuManager.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR)); btnMenuManager.setPreferredSize(new java.awt.Dimension(87, 29)); btnMenuManager.setRequestFocusEnabled(false); btnMenuManager.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnMenuManagerActionPerformed(evt); } }); pHeader.add(btnMenuManager); btnMenuManager.setBounds(460, 30, 153, 29); getContentPane().add(pHeader); pHeader.setBounds(0, 0, 1220, 80); pnlWelcomeMang.setLayout(null); lblmessage.setFont(new java.awt.Font("Rockwell Condensed", 1, 50)); // NOI18N lblmessage.setForeground(new java.awt.Color(255, 255, 255)); lblmessage.setText("See Gusto's latest updates"); lblmessage.setName(""); // NOI18N pnlWelcomeMang.add(lblmessage); lblmessage.setBounds(310, 110, 540, 90); lblWelcome.setFont(new java.awt.Font("Rockwell Condensed", 1, 50)); // NOI18N lblWelcome.setForeground(new java.awt.Color(255, 255, 255)); lblWelcome.setText("Welcome"); lblWelcome.setName(""); // NOI18N pnlWelcomeMang.add(lblWelcome); lblWelcome.setBounds(310, 20, 520, 90); lblImage.setIcon(new javax.swing.ImageIcon(getClass().getResource("/managerPackage/Welcome NOI18N pnlWelcomeMang.add(lblImage); lblImage.setBounds(0, 0, 1220, 810); getContentPane().add(pnlWelcomeMang); pnlWelcomeMang.setBounds(0, 70, 1220, 810); bg.jpg"))); // pack(); }// </editor-fold>//GEN-END:initComponents private void btnLogoutActionPerformed(java.awt.event.ActionEvent evt)//GEN- FIRST:event_btnLogoutActionPerformed {//GEN-HEADEREND:event_btnLogoutActionPerformed HomepageForm homepage = new HomepageForm(true); homepage.setVisible(true); this.dispose(); }//GEN-LAST:event_btnLogoutActionPerformed private void btnInventoryManagerActionPerformed(java.awt.event.ActionEvent evt)//GENFIRST:event_btnInventoryManagerActionPerformed {//GEN-HEADEREND:event_btnInventoryManagerActionPerformed try { // TODO add your handling code here: InventoryForm inv = new InventoryForm(manager); inv.setVisible(true); this.dispose(); } catch (SQLException ex) { Logger.getLogger(ManagerWelcomeForm.class.getName()).log(Level.SEVERE, null, ex); } }//GEN-LAST:event_btnInventoryManagerActionPerformed private void btnMakeAnnouncementActionPerformed(java.awt.event.ActionEvent evt)//GEN-FIRST:event_btnMakeAnnouncementActionPerformed {//GEN-HEADEREND:event_btnMakeAnnouncementActionPerformed try { // TODO add your handling code here: ManagerAnnouncementsForm ann = new ManagerAnnouncementsForm(manager); ann.setVisible(true); this.dispose(); } catch (SQLException ex) { Logger.getLogger(ManagerWelcomeForm.class.getName()).log(Level.SEVERE, null, ex); } }//GEN-LAST:event_btnMakeAnnouncementActionPerformed private void btnMenuManagerActionPerformed(java.awt.event.ActionEvent evt)//GENFIRST:event_btnMenuManagerActionPerformed {//GEN-HEADEREND:event_btnMenuManagerActionPerformed // TODO add your handling code here: Menu m=new Menu(); m.setVisible(true); }//GEN-LAST:event_btnMenuManagerActionPerformed /** * @param args the command line arguments */ public static void main(String args[]) { /* Set the Nimbus look and feel */ //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) "> /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel. * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html */ try { for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) { if ("Nimbus".equals(info.getName())) { javax.swing.UIManager.setLookAndFeel(info.getClassName()); break; } } } catch (ClassNotFoundException ex) { java.util.logging.Logger.getLogger(ManagerWelcomeForm.class.getName()).log(java.util.loggi ng.Level.SEVERE, null, ex); } catch (InstantiationException ex) { java.util.logging.Logger.getLogger(ManagerWelcomeForm.class.getName()).log(java.util.loggi ng.Level.SEVERE, null, ex); } catch (IllegalAccessException ex) { java.util.logging.Logger.getLogger(ManagerWelcomeForm.class.getName()).log(java.util.loggi ng.Level.SEVERE, null, ex); } catch (javax.swing.UnsupportedLookAndFeelException ex) { java.util.logging.Logger.getLogger(ManagerWelcomeForm.class.getName()).log(java.util.loggi ng.Level.SEVERE, null, ex); } //</editor-fold> /* Create and display the form */ java.awt.EventQueue.invokeLater(new Runnable() { public void run() { new ManagerWelcomeForm().setVisible(true); } }); } // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JButton btnInventoryManager; private javax.swing.JButton btnLogout; private javax.swing.JButton btnMakeAnnouncement; private javax.swing.JButton btnMenuManager; private javax.swing.JLabel lbLogo; private javax.swing.JLabel lblImage; private javax.swing.JLabel lblWelcome; private javax.swing.JLabel lblmessage; public static javax.swing.JPanel pHeader; private javax.swing.JPanel pnlWelcomeMang; // End of variables declaration//GEN-END:variables } 13. Kitchen WelcomeForm: /* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package kitchenPackage; /** * * @author ishik */ import customerPackage.*; import menuItems.Menu; import starting.HomepageForm; import kitchenPackage.Kitchen; public class KitchenWelcomeForm extends javax.swing.JFrame { Kitchen kitchen; String orderinString; /** * Creates new form CustomerFormm */ public KitchenWelcomeForm() { initComponents(); } public KitchenWelcomeForm(Kitchen c, String s) { initComponents(); this.setLocationRelativeTo(null); //center form in screen kitchen = c; System.out.println(c.getId()); orderinString = s; String[] name = c.getName().split(" "); lblWelcome.setText("Welcome " + name[0] + ","); } /** * This method is called from within the constructor to initialize the form. * WARNING: Do NOT modify this code. The content of this method is always * regenerated by the Form Editor. */ @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN- BEGIN:initComponents private void initComponents() { pnlWelcomeCust = new javax.swing.JPanel(); lblmessage = new javax.swing.JLabel(); lblWelcome = new javax.swing.JLabel(); lblImage = new javax.swing.JLabel(); pHeader2 = new javax.swing.JPanel(); btnLogout2 = new javax.swing.JButton(); lbLogo = new javax.swing.JLabel(); btnOrdersCustomer = new javax.swing.JButton(); btnMakeOrderCustomer = new javax.swing.JButton(); btnMenuCustomer = new javax.swing.JButton(); setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); setMinimumSize(new java.awt.Dimension(1217, 871)); setUndecorated(true); getContentPane().setLayout(null); pnlWelcomeCust.setLayout(null); lblmessage.setFont(new java.awt.Font("Rockwell Condensed", 1, 36)); // NOI18N lblmessage.setForeground(new java.awt.Color(255, 255, 255)); lblmessage.setText("Here you can see available orders placed by customer"); lblmessage.setName(""); // NOI18N pnlWelcomeCust.add(lblmessage); lblmessage.setBounds(180, 100, 1170, 200); lblWelcome.setFont(new java.awt.Font("Rockwell Condensed", 1, 50)); // NOI18N lblWelcome.setForeground(new java.awt.Color(255, 255, 255)); lblWelcome.setText("Welcome"); lblWelcome.setName(""); // NOI18N pnlWelcomeCust.add(lblWelcome); lblWelcome.setBounds(420, 40, 480, 90); lblImage.setIcon(new javax.swing.ImageIcon(getClass().getResource("/managerPackage/Welcome NOI18N pnlWelcomeCust.add(lblImage); lblImage.setBounds(0, -20, 1220, 830); getContentPane().add(pnlWelcomeCust); pnlWelcomeCust.setBounds(0, 70, 1220, 810); pHeader2.setBackground(new java.awt.Color(255, 213, 0)); bg.jpg"))); // pHeader2.setName("pHeader"); // NOI18N pHeader2.setPreferredSize(new java.awt.Dimension(1062, 70)); pHeader2.setLayout(null); btnLogout2.setBackground(new java.awt.Color(255, 213, 0)); btnLogout2.setFont(new java.awt.Font("Rockwell", 0, 24)); // NOI18N btnLogout2.setForeground(new java.awt.Color(127, 72, 101)); btnLogout2.setText("Log out"); btnLogout2.setToolTipText(""); btnLogout2.setBorder(null); btnLogout2.setBorderPainted(false); btnLogout2.setContentAreaFilled(false); btnLogout2.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR)); btnLogout2.setName(""); // NOI18N btnLogout2.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnLogout2ActionPerformed(evt); } }); pHeader2.add(btnLogout2); btnLogout2.setBounds(1080, 19, 101, 40); lbLogo.setBackground(new java.awt.Color(255, 255, 255)); lbLogo.setFont(new java.awt.Font("Rockwell Condensed", 0, 52)); // NOI18N lbLogo.setForeground(new java.awt.Color(127, 72, 101)); lbLogo.setText("GUSTO"); lbLogo.setToolTipText(""); pHeader2.add(lbLogo); lbLogo.setBounds(30, 10, 200, 67); btnOrdersCustomer.setBackground(new java.awt.Color(255, 213, 0)); btnOrdersCustomer.setFont(new java.awt.Font("Rockwell", 0, 24)); // NOI18N btnOrdersCustomer.setForeground(new java.awt.Color(127, 72, 101)); btnOrdersCustomer.setText("Orders List"); btnOrdersCustomer.setBorder(null); btnOrdersCustomer.setBorderPainted(false); btnOrdersCustomer.setContentAreaFilled(false); btnOrdersCustomer.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR)); btnOrdersCustomer.setPreferredSize(new java.awt.Dimension(87, 29)); btnOrdersCustomer.setRequestFocusEnabled(false); btnOrdersCustomer.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnOrdersCustomerActionPerformed(evt); } }); pHeader2.add(btnOrdersCustomer); btnOrdersCustomer.setBounds(901, 26, 184, 29); btnMakeOrderCustomer.setBackground(new java.awt.Color(255, 213, 0)); btnMakeOrderCustomer.setFont(new java.awt.Font("Rockwell", 0, 24)); // NOI18N btnMakeOrderCustomer.setForeground(new java.awt.Color(127, 72, 101)); btnMakeOrderCustomer.setText("Make Order"); btnMakeOrderCustomer.setBorder(null); btnMakeOrderCustomer.setBorderPainted(false); btnMakeOrderCustomer.setContentAreaFilled(false); btnMakeOrderCustomer.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR)); btnMakeOrderCustomer.setPreferredSize(new java.awt.Dimension(87, 29)); btnMakeOrderCustomer.setRequestFocusEnabled(false); btnMakeOrderCustomer.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnMakeOrderCustomerActionPerformed(evt); } }); pHeader2.add(btnMakeOrderCustomer); btnMakeOrderCustomer.setBounds(750, 20, 170, 40); btnMenuCustomer.setBackground(new java.awt.Color(255, 213, 0)); btnMenuCustomer.setFont(new java.awt.Font("Rockwell", 0, 24)); // NOI18N btnMenuCustomer.setForeground(new java.awt.Color(127, 72, 101)); btnMenuCustomer.setText("Main Menu"); btnMenuCustomer.setBorder(null); btnMenuCustomer.setBorderPainted(false); btnMenuCustomer.setContentAreaFilled(false); btnMenuCustomer.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR)); btnMenuCustomer.setPreferredSize(new java.awt.Dimension(87, 29)); btnMenuCustomer.setRequestFocusEnabled(false); btnMenuCustomer.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnMenuCustomerActionPerformed(evt); } }); pHeader2.add(btnMenuCustomer); btnMenuCustomer.setBounds(600, 20, 153, 40); getContentPane().add(pHeader2); pHeader2.setBounds(0, 0, 1220, 80); pack(); }// </editor-fold>//GEN-END:initComponents private void btnLogout2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN- FIRST:event_btnLogout2ActionPerformed HomepageForm homepage = new HomepageForm(); homepage.setVisible(true); this.dispose(); }//GEN-LAST:event_btnLogout2ActionPerformed private void btnOrdersCustomerActionPerformed(java.awt.event.ActionEvent evt) {//GENFIRST:event_btnOrdersCustomerActionPerformed try{ orderListForm orForm = new orderListForm(); orForm.setVisible(true); this.dispose(); } catch(Exception e){ e.printStackTrace(); } // ShowOrders s = new ShowOrders(customer, orderinString); // s.setVisible(true); // this.dispose(); }//GEN-LAST:event_btnOrdersCustomerActionPerformed private void btnMakeOrderCustomerActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnMakeOrderCustomerActionPerformed // TODO add your handling code here: // OrderForm o = new OrderForm(customer, orderinString); // o.setVisible(true); // this.dispose(); }//GEN-LAST:event_btnMakeOrderCustomerActionPerformed private void btnMenuCustomerActionPerformed(java.awt.event.ActionEvent evt) {//GENFIRST:event_btnMenuCustomerActionPerformed Menu m = new Menu(); m.setVisible(true); }//GEN-LAST:event_btnMenuCustomerActionPerformed /** * @param args the command line arguments */ public static void main(String args[]) { /* Set the Nimbus look and feel */ //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) "> /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel. * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html */ try { for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) { if ("Nimbus".equals(info.getName())) { javax.swing.UIManager.setLookAndFeel(info.getClassName()); break; } } } catch (ClassNotFoundException ex) { java.util.logging.Logger.getLogger(KitchenWelcomeForm.class.getName()).log(java.util.loggin g.Level.SEVERE, null, ex); } catch (InstantiationException ex) { java.util.logging.Logger.getLogger(KitchenWelcomeForm.class.getName()).log(java.util.loggin g.Level.SEVERE, null, ex); } catch (IllegalAccessException ex) { java.util.logging.Logger.getLogger(KitchenWelcomeForm.class.getName()).log(java.util.loggin g.Level.SEVERE, null, ex); } catch (javax.swing.UnsupportedLookAndFeelException ex) { java.util.logging.Logger.getLogger(KitchenWelcomeForm.class.getName()).log(java.util.loggin g.Level.SEVERE, null, ex); } //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> /* Create and display the form */ java.awt.EventQueue.invokeLater(new Runnable() { public void run() { new KitchenWelcomeForm().setVisible(true); } }); } // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JButton btnLogout2; private javax.swing.JButton btnMakeOrderCustomer; private javax.swing.JButton btnMenuCustomer; private javax.swing.JButton btnOrdersCustomer; private javax.swing.JLabel lbLogo; private javax.swing.JLabel lblImage; private javax.swing.JLabel lblWelcome; private javax.swing.JLabel lblmessage; public static javax.swing.JPanel pHeader2; private javax.swing.JPanel pnlWelcomeCust; // End of variables declaration//GEN-END:variables } 14. Kitchen: /* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package kitchenPackage; import customerPackage.Customer; import kitchenPackage.*; import gustorestaurant.MyConnection; import gustorestaurant.User; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import java.text.DateFormat; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Collections; import java.util.Date; import java.util.HashMap; import java.util.logging.Level; import java.util.logging.Logger; import javax.swing.JOptionPane; import menuItems.Inventory; import menuItems.MainMenu; import menuItems.MenuItem; import starting.LoginForm; import starting.SignUpForm; /** * * @author ishik */ public class Kitchen extends User { private String address; private int id; public int getId() { return id; } public String getMobilePhone() { return mobilePhone; } public Kitchen(int id, String name, String username, String mobilePhone, String password, String address) { super(name, username, mobilePhone, password); this.id = id; this.address = address; } public static int getNoKitchens() //for genearting id numbers of new customers { int count = 0; try { PreparedStatement preparedStmt MyConnection.getConnection().prepareStatement("SELECT = count(*) menu_item.kitchen"); ResultSet rs = preparedStmt.executeQuery(); if (rs.next()) { count = rs.getInt("count(*)"); } preparedStmt.closeOnCompletion(); } catch (SQLException ex) { Logger.getLogger(Customer.class.getName()).log(Level.SEVERE, null, ex); } return count; } public String getAddress() { return address; } public String getName() { FROM return name; } public void setAddress(String address) { this.address = address; } public Kitchen() { } @Override public boolean register() { boolean registered = false; //to hide signup form if successfully signed in PreparedStatement ps = null; ResultSet rs; String query = "SELECT * FROM kitchen WHERE kitchen_username = ?"; try { ps = MyConnection.getConnection().prepareStatement(query); ps.setString(1, this.userName); rs = ps.executeQuery(); if (rs.next()) //check if username already exists to prevent duplicate entries { JOptionPane.showMessageDialog(null, "This Username Already Exists"); SignUpForm.setTextField(); return registered; } else { query = "INSERT INTO `kitchen`(`kitchen_username`, `kitchen_mobile`, `kitchen_password`, `kitchen_name`, `kitchen_address`, `kitchen_id`) VALUES (?,?,?,?,?,?)"; ps = MyConnection.getConnection().prepareStatement(query); String encrypted = User.encryptThisString(this.password); ps.setString(1, this.userName); ps.setString(2, this.mobilePhone); ps.setString(3, encrypted); ps.setString(4, this.name); ps.setString(5, this.address); ps.setInt(6, this.id); this.password = encrypted; if (ps.executeUpdate() > 0) { KitchenWelcomeForm cf = new KitchenWelcomeForm(this, null); cf.setVisible(true); registered = true; } } } catch (SQLException ex) { Logger.getLogger(Kitchen.class.getName()).log(Level.SEVERE, null, ex); } return registered; } @Override public boolean login(String cuserName, String cPassword) { boolean loggedIn = false; PreparedStatement ps; ResultSet rs; String query = "SELECT * FROM kitchen WHERE kitchen_username=? AND kitchen_password=?"; try { ps = MyConnection.getConnection().prepareStatement(query); String encrypted = User.encryptThisString(cPassword); ps.setString(1, cuserName); ps.setString(2, encrypted); rs = ps.executeQuery(); if (rs.next()) { String cphone = rs.getString("kitchen_mobile"); String cname = rs.getString("kitchen_name"); String caddress = rs.getString("kitchen_address"); int cid = rs.getInt("kitchen_id"); Kitchen c = new Kitchen(cid, cname, cuserName, cphone, cPassword, caddress); System.out.println(c.getId()); KitchenWelcomeForm cf = new KitchenWelcomeForm(c, null); cf.setVisible(true); loggedIn = true; } else { LoginForm.setTextFields(); JOptionPane.showMessageDialog(null, "Username or password incorrect.", "Login Failed", JOptionPane.ERROR_MESSAGE); } } catch (SQLException ex) { Logger.getLogger(Kitchen.class.getName()).log(Level.SEVERE, null, ex); } return loggedIn; } } 15. OrderListForm: /* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package kitchenPackage; import customerPackage.CusOrder; import customerPackage.myOrderFunctions; import menuItems.*; import menuItems.Menu; import java.awt.Font; import java.sql.*; import java.util.ArrayList; import java.util.logging.Level; import java.util.logging.Logger; import javax.swing.JOptionPane; import javax.swing.table.DefaultTableModel; import managerPackage.Manager; import managerPackage.ManagerAnnouncementsForm; import managerPackage.ManagerWelcomeForm; import starting.HomepageForm; /** * * @author ishik */ public class orderListForm extends javax.swing.JFrame { /** * Creates new form InventoryForm */ //HashMap<String, Double > orderMap = new HashMap<String,Double>(); //reem String choice; public static DefaultTableModel model; Manager manager; //to access inventory items public orderListForm() throws SQLException { initComponents(); initializeComp(); } public orderListForm(Manager m) throws SQLException { initComponents(); this.manager = m; initializeComp(); } private void initializeComp() { this.setLocationRelativeTo(null); //center form in screen // inventory.rateItem(orderMap); model = (DefaultTableModel) tbl_viewItems.getModel(); tbl_viewItems.setVisible(true); tbl_viewItems.getTableHeader().setFont(new Font("Rockwell", Font.BOLD, 20)); displayAllOrders(model); } /** * This method is called from within the constructor to initialize the form. * WARNING: Do NOT modify this code. The content of this method is always * regenerated by the Form Editor. */ @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN- BEGIN:initComponents private void initComponents() { pnl_bg = new javax.swing.JPanel(); btn_serveItem = new javax.swing.JButton(); txt_itemID = new javax.swing.JTextField(); lbl_itemName = new javax.swing.JLabel(); jLabel1 = new javax.swing.JLabel(); jScrollPane1 = new javax.swing.JScrollPane(); tbl_viewItems = new javax.swing.JTable(); lbl_bg = new javax.swing.JLabel(); pHeader2 = new javax.swing.JPanel(); btnLogout2 = new javax.swing.JButton(); lbLogo = new javax.swing.JLabel(); btnOrdersCustomer = new javax.swing.JButton(); btnMenuCustomer = new javax.swing.JButton(); setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); setUndecorated(true); pnl_bg.setLayout(null); btn_serveItem.setFont(new java.awt.Font("Rockwell", 1, 24)); // NOI18N btn_serveItem.setForeground(new java.awt.Color(102, 0, 102)); btn_serveItem.setText("Food Cooked Successfully Serve to Customer"); btn_serveItem.setPreferredSize(new java.awt.Dimension(169, 37)); btn_serveItem.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btn_serveItemActionPerformed(evt); } }); pnl_bg.add(btn_serveItem); btn_serveItem.setBounds(260, 660, 640, 60); txt_itemID.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { txt_itemIDActionPerformed(evt); } }); pnl_bg.add(txt_itemID); txt_itemID.setBounds(620, 570, 150, 50); lbl_itemName.setFont(new java.awt.Font("Rockwell", 0, 28)); // NOI18N lbl_itemName.setForeground(new java.awt.Color(255, 255, 255)); lbl_itemName.setText("Enter Order ID"); pnl_bg.add(lbl_itemName); lbl_itemName.setBounds(380, 570, 210, 40); jLabel1.setFont(new java.awt.Font("Rockwell", 1, 30)); // NOI18N jLabel1.setForeground(new java.awt.Color(255, 255, 255)); jLabel1.setText("Select Order and Serve to Customer"); pnl_bg.add(jLabel1); jLabel1.setBounds(320, 480, 530, 50); tbl_viewItems.setFont(new java.awt.Font("Rockwell", 0, 18)); // NOI18N tbl_viewItems.setModel(new javax.swing.table.DefaultTableModel( new Object [][] { }, new String [] { "Order ID", "Item ID", "Item Name", "Item Quantity", "Customer Name", "Customer Messgae" } ){ boolean[] canEdit = new boolean [] { true, false, false, true, true, true }; public boolean isCellEditable(int rowIndex, int columnIndex) { return canEdit [columnIndex]; } }); tbl_viewItems.setGridColor(new java.awt.Color(255, 255, 255)); tbl_viewItems.setOpaque(false); jScrollPane1.setViewportView(tbl_viewItems); if (tbl_viewItems.getColumnModel().getColumnCount() > 0) { tbl_viewItems.getColumnModel().getColumn(0).setHeaderValue("Order ID"); tbl_viewItems.getColumnModel().getColumn(1).setMinWidth(90); tbl_viewItems.getColumnModel().getColumn(1).setMaxWidth(120); tbl_viewItems.getColumnModel().getColumn(1).setHeaderValue("Item ID"); tbl_viewItems.getColumnModel().getColumn(2).setMinWidth(270); tbl_viewItems.getColumnModel().getColumn(2).setMaxWidth(280); tbl_viewItems.getColumnModel().getColumn(2).setHeaderValue("Item Name"); tbl_viewItems.getColumnModel().getColumn(3).setMinWidth(120); tbl_viewItems.getColumnModel().getColumn(3).setMaxWidth(150); tbl_viewItems.getColumnModel().getColumn(3).setHeaderValue("Item Quantity"); tbl_viewItems.getColumnModel().getColumn(4).setMinWidth(100); tbl_viewItems.getColumnModel().getColumn(4).setMaxWidth(150); tbl_viewItems.getColumnModel().getColumn(4).setHeaderValue("Customer Name"); tbl_viewItems.getColumnModel().getColumn(5).setMinWidth(150); tbl_viewItems.getColumnModel().getColumn(5).setMaxWidth(200); tbl_viewItems.getColumnModel().getColumn(5).setHeaderValue("Customer Messgae"); } pnl_bg.add(jScrollPane1); jScrollPane1.setBounds(50, 130, 1050, 330); lbl_bg.setIcon(new javax.swing.ImageIcon(getClass().getResource("/menuItems/Food- Inventory-Management-What-It-Is-and-How-to-Do-It-Well-1.jpg"))); // NOI18N lbl_bg.setText("jLabel1"); pnl_bg.add(lbl_bg); lbl_bg.setBounds(0, 80, 1220, 710); pHeader2.setBackground(new java.awt.Color(255, 213, 0)); pHeader2.setName("pHeader"); // NOI18N pHeader2.setPreferredSize(new java.awt.Dimension(1062, 70)); pHeader2.setLayout(null); btnLogout2.setBackground(new java.awt.Color(255, 213, 0)); btnLogout2.setFont(new java.awt.Font("Rockwell", 0, 24)); // NOI18N btnLogout2.setForeground(new java.awt.Color(127, 72, 101)); btnLogout2.setText("Log out"); btnLogout2.setToolTipText(""); btnLogout2.setBorder(null); btnLogout2.setBorderPainted(false); btnLogout2.setContentAreaFilled(false); btnLogout2.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR)); btnLogout2.setName(""); // NOI18N btnLogout2.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnLogout2ActionPerformed(evt); } }); pHeader2.add(btnLogout2); btnLogout2.setBounds(1080, 19, 101, 40); lbLogo.setBackground(new java.awt.Color(255, 255, 255)); lbLogo.setFont(new java.awt.Font("Rockwell Condensed", 0, 52)); // NOI18N lbLogo.setForeground(new java.awt.Color(127, 72, 101)); lbLogo.setText("GUSTO"); lbLogo.setToolTipText(""); pHeader2.add(lbLogo); lbLogo.setBounds(30, 10, 200, 67); btnOrdersCustomer.setBackground(new java.awt.Color(255, 213, 0)); btnOrdersCustomer.setFont(new java.awt.Font("Rockwell", 0, 24)); // NOI18N btnOrdersCustomer.setForeground(new java.awt.Color(127, 72, 101)); btnOrdersCustomer.setText("Orders List"); btnOrdersCustomer.setBorder(null); btnOrdersCustomer.setBorderPainted(false); btnOrdersCustomer.setContentAreaFilled(false); btnOrdersCustomer.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR)); btnOrdersCustomer.setPreferredSize(new java.awt.Dimension(87, 29)); btnOrdersCustomer.setRequestFocusEnabled(false); btnOrdersCustomer.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnOrdersCustomerActionPerformed(evt); } }); pHeader2.add(btnOrdersCustomer); btnOrdersCustomer.setBounds(901, 26, 184, 29); btnMenuCustomer.setBackground(new java.awt.Color(255, 213, 0)); btnMenuCustomer.setFont(new java.awt.Font("Rockwell", 0, 24)); // NOI18N btnMenuCustomer.setForeground(new java.awt.Color(127, 72, 101)); btnMenuCustomer.setText("Main Menu"); btnMenuCustomer.setBorder(null); btnMenuCustomer.setBorderPainted(false); btnMenuCustomer.setContentAreaFilled(false); btnMenuCustomer.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR)); btnMenuCustomer.setPreferredSize(new java.awt.Dimension(87, 29)); btnMenuCustomer.setRequestFocusEnabled(false); btnMenuCustomer.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnMenuCustomerActionPerformed(evt); } }); pHeader2.add(btnMenuCustomer); btnMenuCustomer.setBounds(750, 20, 153, 40); pnl_bg.add(pHeader2); pHeader2.setBounds(0, 0, 1220, 80); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(pnl_bg, Short.MAX_VALUE) javax.swing.GroupLayout.DEFAULT_SIZE, 1216, ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(pnl_bg, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 788, Short.MAX_VALUE) ); pack(); }// </editor-fold>//GEN-END:initComponents private void btn_serveItemActionPerformed(java.awt.event.ActionEvent evt) {//GENFIRST:event_btn_serveItemActionPerformed // TODO add your handling code here: if (txt_itemID.getText().isEmpty()) { JOptionPane.showMessageDialog(this, "Pls provide Id of order", "Error", JOptionPane.PLAIN_MESSAGE); } else { if (new myOrderFunctions().updateOrder(Integer.parseInt(txt_itemID.getText()))) { displayAllOrders((DefaultTableModel) tbl_viewItems.getModel()); } else { JOptionPane.showMessageDialog(this, "Pls provide valid Id of order", "Error", JOptionPane.PLAIN_MESSAGE); } } }//GEN-LAST:event_btn_serveItemActionPerformed private void btnLogout2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN- FIRST:event_btnLogout2ActionPerformed HomepageForm homepage = new HomepageForm(); homepage.setVisible(true); this.dispose(); }//GEN-LAST:event_btnLogout2ActionPerformed private void btnOrdersCustomerActionPerformed(java.awt.event.ActionEvent evt) {//GENFIRST:event_btnOrdersCustomerActionPerformed // ShowOrders s = new ShowOrders(customer, orderinString); // s.setVisible(true); // this.dispose(); }//GEN-LAST:event_btnOrdersCustomerActionPerformed private void btnMenuCustomerActionPerformed(java.awt.event.ActionEvent evt) {//GENFIRST:event_btnMenuCustomerActionPerformed Menu m = new Menu(); m.setVisible(true); }//GEN-LAST:event_btnMenuCustomerActionPerformed private void txt_itemIDActionPerformed(java.awt.event.ActionEvent FIRST:event_txt_itemIDActionPerformed // TODO add your handling code here: evt) {//GEN- }//GEN-LAST:event_txt_itemIDActionPerformed /** * @param args the command line arguments */ public static void main(String args[]) { /* Set the Nimbus look and feel */ //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) "> /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel. * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html */ try { for (javax.swing.UIManager.LookAndFeelInfo info javax.swing.UIManager.getInstalledLookAndFeels()) { if ("Nimbus".equals(info.getName())) { javax.swing.UIManager.setLookAndFeel(info.getClassName()); break; } } } catch (ClassNotFoundException ex) { java.util.logging.Logger.getLogger(orderListForm.class.getName()).log(java.util.logging.Level. SEVERE, null, ex); } catch (InstantiationException ex) { : java.util.logging.Logger.getLogger(orderListForm.class.getName()).log(java.util.logging.Level. SEVERE, null, ex); } catch (IllegalAccessException ex) { java.util.logging.Logger.getLogger(orderListForm.class.getName()).log(java.util.logging.Level. SEVERE, null, ex); } catch (javax.swing.UnsupportedLookAndFeelException ex) { java.util.logging.Logger.getLogger(orderListForm.class.getName()).log(java.util.logging.Level. SEVERE, null, ex); } //</editor-fold> //</editor-fold> /* Create and display the form */ java.awt.EventQueue.invokeLater(new Runnable() { public void run() { try { new orderListForm().setVisible(true); } catch (SQLException ex) { Logger.getLogger(orderListForm.class.getName()).log(Level.SEVERE, null, ex); } } }); } public void displayAllOrders(DefaultTableModel model) { model.getDataVector().removeAllElements(); model.fireTableDataChanged(); // notifies the JTable that the model has changed ArrayList<CusOrder> order_data = new myOrderFunctions().getAllOrders(); if (order_data.isEmpty()) { System.out.println("customerPackage.OrderForm.btn_orderStatusActionPerformed() Error"); JOptionPane.showMessageDialog(this, "No Order Found"); } else { for (int i = 0; i < order_data.size(); i++) { CusOrder cusOrder = order_data.get(i); model.addRow(new cusOrder.getOrder_menuItemId(), Object[]{cusOrder.getOrderId(), cusOrder.getOrder_menuItemName(), cusOrder.getOrder_menuItemQuantity(), cusOrder.getOrder_customerName()}); } System.out.println(order_data); } } // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JButton btnLogout2; private javax.swing.JButton btnMenuCustomer; private javax.swing.JButton btnOrdersCustomer; private javax.swing.JButton btn_serveItem; private javax.swing.JLabel jLabel1; private javax.swing.JScrollPane jScrollPane1; private javax.swing.JLabel lbLogo; private javax.swing.JLabel lbl_bg; private javax.swing.JLabel lbl_itemName; public static javax.swing.JPanel pHeader2; private javax.swing.JPanel pnl_bg; public static javax.swing.JTable tbl_viewItems; private javax.swing.JTextField txt_itemID; // End of variables declaration//GEN-END:variables } 16. User: /* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package gustorestaurant; import java.math.BigInteger; import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import java.util.ArrayList; import java.util.logging.Level; import java.util.logging.Logger; import javax.swing.JOptionPane; import managerPackage.Announcement; import menuItems.Inventory; import static menuItems.Inventory.inventoryList; import menuItems.MainMenu; import menuItems.MenuItem; import starting.HomepageForm; /** * * @author ishik */ abstract public class User { protected final String name; protected final String userName; protected String mobilePhone; protected String password; public User() { name = ""; userName = ""; } public User(String name, String userName, String mobilePhone, String password) { this.mobilePhone = mobilePhone; this.name = name; this.userName = userName; this.password = password; } /** * */ public abstract boolean register(); /** * * @param userName * @param password */ public abstract boolean login(String userName, String password); public static String encryptThisString(String input) { try { // getInstance() method is called with algorithm SHA-1 MessageDigest md = MessageDigest.getInstance("SHA-1"); byte[] messageDigest = md.digest(input.getBytes()); // Convert byte array into signum representation BigInteger no = new BigInteger(1, messageDigest); // Convert message digest into hex value String hashtext = no.toString(16); // Add preceding 0s to make it 32 bit while (hashtext.length() < 32) { hashtext = "0" + hashtext; } // return the HashText return hashtext; } catch (NoSuchAlgorithmException e) { JOptionPane.showMessageDialog(null, e.getMessage()); } return null; } //reading announcements from DB public static void viewAnnouncements() { try { PreparedStatement preparedStmt MyConnection.getConnection().prepareStatement("select * from announcements"); ResultSet rs = preparedStmt.executeQuery(); while (rs.next()) { String name = rs.getString("managerName"); String message = rs.getString("message"); int price = rs.getInt("price"); String items = rs.getString("menuItems"); ArrayList<MenuItem> getItem = convertStringtoItems(items); Announcement a = new Announcement(name, message, price, getItem); HomepageForm.offers.add(a); } } catch (SQLException ex) { Logger.getLogger(User.class.getName()).log(Level.SEVERE, null, ex); } } //helper function, converts list of menu item names to string to write it in DB protected static String convertItemstoString(ArrayList<MenuItem> m) { String s = ""; for (int i = 0; i < m.size(); ++i) { String itemName; = itemName = m.get(i).getItemName(); s += itemName + "+"; } return s; } //helper function, converts string of menu item names in DB to objects of menu items protected static ArrayList<MenuItem> convertStringtoItems(String s) { ArrayList<MenuItem> menuItems = new ArrayList<>(); String[] offerItems = s.split("\\+"); for (String a : offerItems) { MenuItem m = inventoryList.get(a).getMenuItem(); menuItems.add(m); } return menuItems; } } 17. MyConnection: /* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package gustorestaurant; import java.sql.Connection; import java.sql.DriverManager; import java.sql.SQLException; /** * * @author ishik */ public class MyConnection { public static Connection getConnection() { Connection con = null; try { Class.forName("com.mysql.jdbc.Driver"); con = DriverManager.getConnection("jdbc:mysql://localhost/menu_item", "root", ""); // "jdbc:mysql://localhost:3306/projectdb?useSSL=false&autoReconnect=true","root","root"); } catch (SQLException | ClassNotFoundException e) { System.out.println(e.getMessage()); } return con; } static Object getconnection() { throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. } } 18. Restaurant: /* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package gustorestaurant; import java.util.ArrayList; import menuItems.Inventory; import menuItems.MainMenu; import starting.HomepageForm; import static starting.HomepageForm.offers; /** * * @author ishik */ public class GustoRestaurant { /** * @param args the command line arguments */ public static void main(String[] args) { // MainMenu.categoryList.clear(); // MainMenu mainmenu = new MainMenu(); // mainmenu.setCategoryItem(); //load main menu Inventory inventory = new Inventory(); inventory.setInventoryItems(); //load inventory // offers = new ArrayList<>(); // User.viewAnnouncements(); // HomepageForm h = new HomepageForm(); // h.setVisible(true); } } 19. Waiter: /* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package customerPackage; /** * * @author ishik */ import gustorestaurant.MyConnection; import java.awt.Menu; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import java.text.DateFormat; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Date; import java.util.HashMap; import java.util.logging.Level; import java.util.logging.Logger; public class Waiter { private String id; private String name; static final int maxOrders = 2; private boolean available; private Date end; private Date start; private ArrayList<Order> ordersList; private Order order = new Order(); DateFormat dateFormat = new SimpleDateFormat("h:mm aa"); public static HashMap<String, Waiter> waiterList = new HashMap<>(); //System.out.println(dateFormat.format (date)); public Waiter() { this.ordersList = new ArrayList<>(); } public Waiter(String id, String name, boolean available, ArrayList<Order> ordersList) { this.id = id; this.name = name; this.available = available; this.ordersList = ordersList; } // to fill waiters List from database void addOrder(String orderId) { //to read null Strings from data base if (orderId == null) { return; } this.ordersList.add(order); } public Date getEnd() { return end; } public Date getStart() { return start; } public String getId() { return id; } public void setOrder(Order order) { this.order = order; } public Order getOrder() { return order; } public void setId(String id) { this.id = id; } public String getName() { return name; } public void setName(String name) { this.name = name; } public boolean isAvailable() { return available; } public void setAvailable(boolean available) { this.available = available; } public ArrayList<Order> getOrdersList() { return ordersList; } public void setOrdersList(ArrayList<Order> ordersList) { this.ordersList = ordersList; } public void setEnd(Date end) { this.end = end; } public void setStart(Date start) { this.start = start; } public void setWaiters() { Waiter waiter; try { PreparedStatement preparedStmt MyConnection.getConnection().prepareStatement("select * from menu_item.Waiters"); ResultSet rs = preparedStmt.executeQuery(); while (rs.next()) { waiter = new Waiter(); waiter.setId(rs.getString("id_Waiters")); waiter.setName(rs.getString("name_Waiters")); waiter.setStart(dateFormat.parse(rs.getString("start_time_waiters"))); waiter.setEnd(dateFormat.parse(rs.getString("finish_time_waiters"))); waiter.setAvailable(rs.getBoolean("status_Waiters")); if (rs.getString("order1_Waiters") != null) { waiter.addOrder(rs.getString("order1_Waiters")); } if (rs.getString("order2_Waiters") != null) { = waiter.addOrder(rs.getString("order2_Waiters")); } System.out.println(waiter.getName()+" "+waiter.isAvailable()+" " +dateFormat.format(waiter.getStart())+" "+dateFormat.format(waiter.getEnd())+" "+waiter.getOrdersList().size()+" in reading"); waiterList.put(waiter.getId(), waiter); } } catch (SQLException ex) { Logger.getLogger(Menu.class.getName()).log(Level.SEVERE, null, ex); } catch (ParseException ex) { Logger.getLogger(Waiter.class.getName()).log(Level.SEVERE, null, ex); } } } 20. ShowOrders: package customerPackage; import static customerPackage.OrderForm.customer; import java.util.ArrayList; import javax.swing.JOptionPane; import menuItems.Menu; import starting.HomepageForm; public class ShowOrders extends javax.swing.JFrame { Customer c; String s; void DisplayOrders() { String messageDisplay = " Item \t Price \t Quantity \t CookedStatus \n " + "________________________________________________\n"; ArrayList<CusOrder> order_data = new myOrderFunctions().getOrdersByCusId(customer.getId()); if (order_data.isEmpty()) { System.out.println("customerPackage.OrderForm.btn_orderStatusActionPerformed() Error"); JOptionPane.showMessageDialog(this, "No item found pls add items first"); } else { float total_bill = 0; for (int i = 0; i < order_data.size(); i++) { messageDisplay = messageDisplay + order_data.get(i).getOrder_menuItemName() + "\t" + order_data.get(i).getOrder_menuItemPrice() order_data.get(i).getOrder_menuItemQuantity() + + "\t" "\t" + + order_data.get(i).getOrder_cookedStatus() + "\n"; total_bill = total_bill + order_data.get(i).getOrder_menuItemPrice() order_data.get(i).getOrder_menuItemQuantity(); * } messageDisplay = messageDisplay "________________________________________________\n\n"; messageDisplay = messageDisplay + "Total Biling Amount = "+total_bill+" Rs."; System.out.println(messageDisplay); System.out.println(order_data); jTextArea1.append(messageDisplay); } } public ShowOrders() { initComponents(); this.setLocationRelativeTo(null); //center form in screen DisplayOrders(); } public ShowOrders(Customer c, String s) { initComponents(); this.setLocationRelativeTo(null); //center form in screen this.c = c; this.s = s; DisplayOrders(); + } /** * This method is called from within the constructor to initialize the form. * WARNING: Do NOT modify this code. The content of this method is always * regenerated by the Form Editor. */ @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN- BEGIN:initComponents private void initComponents() { jPanel1 = new javax.swing.JPanel(); jScrollPane2 = new javax.swing.JScrollPane(); jTextArea1 = new javax.swing.JTextArea(); jLabel1 = new javax.swing.JLabel(); pHeader = new javax.swing.JPanel(); btnLogout = new javax.swing.JButton(); lbLogo = new javax.swing.JLabel(); btnOrdersCustomer = new javax.swing.JButton(); btnMakeOrderCustomer = new javax.swing.JButton(); btnMenuCustomer = new javax.swing.JButton(); btnBestSellersCustomer = new javax.swing.JButton(); setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE); setMinimumSize(new java.awt.Dimension(1217, 871)); setUndecorated(true); jPanel1.setBackground(new java.awt.Color(255, 255, 255)); jPanel1.setPreferredSize(new java.awt.Dimension(1216, 788)); jPanel1.setLayout(null); jTextArea1.setColumns(20); jTextArea1.setRows(5); jScrollPane2.setViewportView(jTextArea1); jPanel1.add(jScrollPane2); jScrollPane2.setBounds(82, 87, 447, 403); jLabel1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/customerPackage/171016_FOOD_TINDER.gif "))); // NOI18N jLabel1.setPreferredSize(new java.awt.Dimension(1216, 788)); jPanel1.add(jLabel1); jLabel1.setBounds(0, 10, 1220, 830); pHeader.setBackground(new java.awt.Color(255, 213, 0)); pHeader.setName("pHeader"); // NOI18N pHeader.setPreferredSize(new java.awt.Dimension(1062, 70)); pHeader.setLayout(null); btnLogout.setBackground(new java.awt.Color(255, 213, 0)); btnLogout.setFont(new java.awt.Font("Rockwell", 0, 24)); // NOI18N btnLogout.setForeground(new java.awt.Color(127, 72, 101)); btnLogout.setText("Log out"); btnLogout.setToolTipText(""); btnLogout.setBorder(null); btnLogout.setBorderPainted(false); btnLogout.setContentAreaFilled(false); btnLogout.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR)); btnLogout.setName(""); // NOI18N btnLogout.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnLogoutActionPerformed(evt); } }); pHeader.add(btnLogout); btnLogout.setBounds(1080, 19, 101, 40); lbLogo.setBackground(new java.awt.Color(255, 255, 255)); lbLogo.setFont(new java.awt.Font("Rockwell Condensed", 0, 52)); // NOI18N lbLogo.setForeground(new java.awt.Color(127, 72, 101)); lbLogo.setText("GUSTO"); lbLogo.setToolTipText(""); pHeader.add(lbLogo); lbLogo.setBounds(30, 10, 120, 62); btnOrdersCustomer.setBackground(new java.awt.Color(255, 213, 0)); btnOrdersCustomer.setFont(new java.awt.Font("Rockwell", 0, 24)); // NOI18N btnOrdersCustomer.setForeground(new java.awt.Color(127, 72, 101)); btnOrdersCustomer.setText("My Orders"); btnOrdersCustomer.setBorder(null); btnOrdersCustomer.setBorderPainted(false); btnOrdersCustomer.setContentAreaFilled(false); btnOrdersCustomer.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR)); btnOrdersCustomer.setPreferredSize(new java.awt.Dimension(87, 29)); btnOrdersCustomer.setRequestFocusEnabled(false); btnOrdersCustomer.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnOrdersCustomerActionPerformed(evt); } }); pHeader.add(btnOrdersCustomer); btnOrdersCustomer.setBounds(901, 26, 184, 29); btnMakeOrderCustomer.setBackground(new java.awt.Color(255, 213, 0)); btnMakeOrderCustomer.setFont(new java.awt.Font("Rockwell", 0, 24)); // NOI18N btnMakeOrderCustomer.setForeground(new java.awt.Color(127, 72, 101)); btnMakeOrderCustomer.setText("Make Order"); btnMakeOrderCustomer.setBorder(null); btnMakeOrderCustomer.setBorderPainted(false); btnMakeOrderCustomer.setContentAreaFilled(false); btnMakeOrderCustomer.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR)); btnMakeOrderCustomer.setPreferredSize(new java.awt.Dimension(87, 29)); btnMakeOrderCustomer.setRequestFocusEnabled(false); btnMakeOrderCustomer.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnMakeOrderCustomerActionPerformed(evt); } }); pHeader.add(btnMakeOrderCustomer); btnMakeOrderCustomer.setBounds(750, 20, 170, 40); btnMenuCustomer.setBackground(new java.awt.Color(255, 213, 0)); btnMenuCustomer.setFont(new java.awt.Font("Rockwell", 0, 24)); // NOI18N btnMenuCustomer.setForeground(new java.awt.Color(127, 72, 101)); btnMenuCustomer.setText("Main Menu"); btnMenuCustomer.setBorder(null); btnMenuCustomer.setBorderPainted(false); btnMenuCustomer.setContentAreaFilled(false); btnMenuCustomer.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR)); btnMenuCustomer.setPreferredSize(new java.awt.Dimension(87, 29)); btnMenuCustomer.setRequestFocusEnabled(false); btnMenuCustomer.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnMenuCustomerActionPerformed(evt); } }); pHeader.add(btnMenuCustomer); btnMenuCustomer.setBounds(430, 20, 153, 40); btnBestSellersCustomer.setBackground(new java.awt.Color(255, 213, 0)); btnBestSellersCustomer.setFont(new java.awt.Font("Rockwell", 0, 24)); // NOI18N btnBestSellersCustomer.setForeground(new java.awt.Color(127, 72, 101)); btnBestSellersCustomer.setText("Best Selling"); btnBestSellersCustomer.setBorder(null); btnBestSellersCustomer.setBorderPainted(false); btnBestSellersCustomer.setContentAreaFilled(false); btnBestSellersCustomer.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR)); btnBestSellersCustomer.setPreferredSize(new java.awt.Dimension(87, 29)); btnBestSellersCustomer.setRequestFocusEnabled(false); btnBestSellersCustomer.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnBestSellersCustomerActionPerformed(evt); } }); pHeader.add(btnBestSellersCustomer); btnBestSellersCustomer.setBounds(590, 20, 153, 40); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(pHeader, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() .addComponent(pHeader, javax.swing.GroupLayout.PREFERRED_SIZE, 78, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, 815, javax.swing.GroupLayout.PREFERRED_SIZE)) ); pack(); }// </editor-fold>//GEN-END:initComponents private void btnLogoutActionPerformed(java.awt.event.ActionEvent evt)//GEN- FIRST:event_btnLogoutActionPerformed {//GEN-HEADEREND:event_btnLogoutActionPerformed HomepageForm homepage = new HomepageForm(true); homepage.setVisible(true); this.dispose(); }//GEN-LAST:event_btnLogoutActionPerformed private void btnOrdersCustomerActionPerformed(java.awt.event.ActionEvent evt)//GENFIRST:event_btnOrdersCustomerActionPerformed {//GEN-HEADEREND:event_btnOrdersCustomerActionPerformed ShowOrders o = new ShowOrders(c, s); o.setVisible(true); this.dispose(); }//GEN-LAST:event_btnOrdersCustomerActionPerformed private void btnMakeOrderCustomerActionPerformed(java.awt.event.ActionEvent evt)//GEN-FIRST:event_btnMakeOrderCustomerActionPerformed {//GEN-HEADEREND:event_btnMakeOrderCustomerActionPerformed // TODO add your handling code here: OrderForm o = new OrderForm(c, s); o.setVisible(true); this.dispose(); }//GEN-LAST:event_btnMakeOrderCustomerActionPerformed private void btnMenuCustomerActionPerformed(java.awt.event.ActionEvent evt)//GENFIRST:event_btnMenuCustomerActionPerformed {//GEN-HEADEREND:event_btnMenuCustomerActionPerformed Menu m = new Menu(); m.setVisible(true); }//GEN-LAST:event_btnMenuCustomerActionPerformed private void btnBestSellersCustomerActionPerformed(java.awt.event.ActionEvent evt)//GEN-FIRST:event_btnBestSellersCustomerActionPerformed {//GEN-HEADEREND:event_btnBestSellersCustomerActionPerformed BestSellerForm b = new BestSellerForm(c, s); b.setVisible(true); this.dispose(); }//GEN-LAST:event_btnBestSellersCustomerActionPerformed /** * @param args the command line arguments */ public static void main(String args[]) { /* Set the Nimbus look and feel */ //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) "> /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel. * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html */ try { for (javax.swing.UIManager.LookAndFeelInfo info javax.swing.UIManager.getInstalledLookAndFeels()) { if ("Nimbus".equals(info.getName())) { javax.swing.UIManager.setLookAndFeel(info.getClassName()); break; } } } catch (ClassNotFoundException ex) { java.util.logging.Logger.getLogger(ShowOrders.class.getName()).log(java.util.logging.Level.SE VERE, null, ex); } catch (InstantiationException ex) { : java.util.logging.Logger.getLogger(ShowOrders.class.getName()).log(java.util.logging.Level.SE VERE, null, ex); } catch (IllegalAccessException ex) { java.util.logging.Logger.getLogger(ShowOrders.class.getName()).log(java.util.logging.Level.SE VERE, null, ex); } catch (javax.swing.UnsupportedLookAndFeelException ex) { java.util.logging.Logger.getLogger(ShowOrders.class.getName()).log(java.util.logging.Level.SE VERE, null, ex); } //</editor-fold> //</editor-fold> /* Create and display the form */ java.awt.EventQueue.invokeLater(new Runnable() { public void run() { new ShowOrders().setVisible(true); } }); } // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JButton btnBestSellersCustomer; private javax.swing.JButton btnLogout; private javax.swing.JButton btnMakeOrderCustomer; private javax.swing.JButton btnMenuCustomer; private javax.swing.JButton btnOrdersCustomer; private javax.swing.JLabel jLabel1; private javax.swing.JPanel jPanel1; private javax.swing.JScrollPane jScrollPane2; private javax.swing.JTextArea jTextArea1; private javax.swing.JLabel lbLogo; public static javax.swing.JPanel pHeader; // End of variables declaration//GEN-END:variables } 21. OrderForm: package customerPackage; import customerPackage.BillForm; import customerPackage.Customer; import customerPackage.Waiter; import customerPackage.Order; import customerPackage.Voucher; import java.sql.SQLException; import java.text.DateFormat; import java.text.ParseException; import java.text.SimpleDateFormat; import java.time.LocalTime; import java.util.ArrayList; import java.util.Date; import java.util.HashMap; import javafx.util.Pair; import java.util.Iterator; import javafx.scene.control.Spinner; import javax.swing.*; import java.util.Timer; import java.util.TimerTask; import java.util.logging.Level; import java.util.logging.Logger; import javax.swing.JSpinner.DefaultEditor; import managerPackage.Announcement; import menuItems.Inventory; import menuItems.MainMenu; import menuItems.Menu; import starting.HomepageForm; /* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ /** * * @author ishik */ public class OrderForm extends javax.swing.JFrame { BillForm bill; static Order currentOrder; static int quantity; String category; static HashMap<String, Integer> orderPrice; MainMenu mainMenu = new MainMenu(); boolean isCategory; Inventory inventory = new Inventory(); static Customer customer = new Customer(); static Waiter waiter; static Voucher voucher = new Voucher(); long ONE_MINUTE_IN_MILLIS = 60000; long orderStartMillis; Date afterAddingTenMins; boolean notFirstVisit = false; String menuIds; boolean pressedOffers = false; /** * Creates new form Order */ public OrderForm() { currentOrder = new Order(); initComponents(); mainMenu.setCategoryItem(); inventory.setInventoryItems(); initializeComp(); } public OrderForm(Customer customer, String Ids) { initComponents(); this.customer = customer; menuIds = Ids; String id = String.valueOf(customer.getId()); boolean isLastserved = checkLastOrders(customer); if (isLastserved) { currentOrder = new Order(String.valueOf(Order.getNoOrders() String.valueOf(customer.getId()), customer.getName(), + customer.getAddress(), customer.getMobilePhone()); } else { currentOrder = customer.getOrders().get(customer.getOrders().size() - 1); notFirstVisit = true; } if (customer.getOrders().size() > 0) { customer.setTempOrder(customer.getOrders().get(customer.getOrders().size() - 1)); //System.out.println(customer.getTempOrder().getId()+" "+customer.getTempOrder().getStatus()+" in comstructor order Form"); } //System.out.println(String.valueOf(customer.getId())); initializeComp(); } 1), private boolean checkLastOrders(Customer c) { Order tempOrder = new Order(); if (c.getOrders().size() > 0) { tempOrder = c.getOrders().get(c.getOrders().size() - 1); // if(tempOrder.checkStatus(tempOrder)) // { // return true; // } if (tempOrder.getStatus()) { return true; } else { return false; } } else { return true; } } private void initializeComp() { this.setLocationRelativeTo(null); //center form in screen this.orderPrice = new HashMap<>(); waiter = new Waiter(); waiter.setWaiters(); voucher.setVouchers(); ((DefaultEditor) spin_quantity.getEditor()).getTextField().setEditable(false); //to make spinner non editable cbx_choose_order.setModel(new DefaultComboBoxModel<>(new String[]{ "" })); //clear combo box in the first open cbx_choose_order.setSelectedIndex(-1); cbx_promoCode.setSelectedIndex(-1); fillVoucher(); cbx_promoCode.setSelectedIndex(-1); } public void offer(String voucherId) { int precentage; precentage = voucher.getPercentage(voucherId); //if the voucher is valid set the voucher obj info if (precentage != 0) { voucher.setId(voucherId); voucher.setPercentage(precentage); voucher.setReleaseDate(Voucher.voucherList.get(voucherId).getReleaseDate()); voucher.setExpirationDate(Voucher.voucherList.get(voucherId).getExpirationDate()); } } public void fillVoucher() { Voucher.voucherList.keySet().forEach((voucherId) -> { cbx_promoCode.addItem(voucherId); }); } public void fillComboBox(String categoryName) { cbx_choose_order.setModel(new DefaultComboBoxModel<>(new String[]{ "" })); isCategory = false; MainMenu.categoryList.keySet().forEach((category) -> { if (category.equals(categoryName)) { isCategory = true; } for (int i = 0; i < MainMenu.categoryList.get(category).size(); ++i) { String itemName = MainMenu.categoryList.get(category).get(i).getItemName(); int price = MainMenu.categoryList.get(category).get(i).getItemPrice(); if (isCategory) { cbx_choose_order.addItem(itemName); } orderPrice.put(itemName, price); } isCategory = false; }); } public final void setInitialValues() //clear combo box and spinner after each entery { //cbx_choose_order.setModel(new DefaultComboBoxModel<>(new String[]{""})); cbx_choose_order.setSelectedIndex(-1); spin_quantity.setValue(1); } /** * This method is called from within the constructor to initialize the form. * WARNING: Do NOT modify this code. The content of this method is always * regenerated by the Form Editor. */ @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" BEGIN:initComponents private void initComponents() { pnl_background = new javax.swing.JPanel(); btn_orderStatus = new javax.swing.JButton(); btn_pizza = new javax.swing.JButton(); btn_pasta = new javax.swing.JButton(); btn_showBill = new javax.swing.JButton(); btn_burgers = new javax.swing.JButton(); btn_drinks = new javax.swing.JButton(); btn_stillOrdering = new javax.swing.JButton(); desc="Generated Code">//GEN- cbx_promoCode = new javax.swing.JComboBox<>(); cbx_choose_order = new javax.swing.JComboBox<>(); spin_quantity = new javax.swing.JSpinner(); btn_appetizers1 = new javax.swing.JButton(); btn_desserts1 = new javax.swing.JButton(); btn_offers = new javax.swing.JButton(); lbl_promoCode = new javax.swing.JLabel(); lbl_OrderType1 = new javax.swing.JLabel(); lbl_quantity = new javax.swing.JLabel(); lbl_order_background = new javax.swing.JLabel(); pHeader = new javax.swing.JPanel(); btnLogout = new javax.swing.JButton(); lbLogo = new javax.swing.JLabel(); btnOrdersCustomer = new javax.swing.JButton(); btnMakeOrderCustomer = new javax.swing.JButton(); btnMenuCustomer = new javax.swing.JButton(); btnBestSellersCustomer = new javax.swing.JButton(); setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE); setTitle("Order"); setMinimumSize(new java.awt.Dimension(1217, 788)); setUndecorated(true); pnl_background.setPreferredSize(new java.awt.Dimension(1216, 711)); pnl_background.setLayout(null); btn_orderStatus.setBackground(new java.awt.Color(255, 213, 0)); btn_orderStatus.setFont(new java.awt.Font("Rockwell", 1, 24)); // NOI18N btn_orderStatus.setForeground(new java.awt.Color(102, 0, 102)); btn_orderStatus.setText("Order Status"); btn_orderStatus.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR)); btn_orderStatus.setPreferredSize(new java.awt.Dimension(180, 50)); btn_orderStatus.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btn_orderStatusActionPerformed(evt); } }); pnl_background.add(btn_orderStatus); btn_orderStatus.setBounds(880, 110, 190, 50); btn_pizza.setBackground(new java.awt.Color(255, 255, 255)); btn_pizza.setFont(new java.awt.Font("Rockwell", 1, 24)); // NOI18N btn_pizza.setForeground(new java.awt.Color(102, 0, 102)); btn_pizza.setText("Pizza"); btn_pizza.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR)); btn_pizza.setPreferredSize(new java.awt.Dimension(180, 50)); btn_pizza.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btn_pizzaActionPerformed(evt); } }); pnl_background.add(btn_pizza); btn_pizza.setBounds(30, 400, 180, 50); btn_pasta.setBackground(new java.awt.Color(255, 255, 255)); btn_pasta.setFont(new java.awt.Font("Rockwell", 1, 24)); // NOI18N btn_pasta.setForeground(new java.awt.Color(102, 0, 102)); btn_pasta.setText("Pasta"); btn_pasta.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR)); btn_pasta.setPreferredSize(new java.awt.Dimension(180, 50)); btn_pasta.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btn_pastaActionPerformed(evt); } }); pnl_background.add(btn_pasta); btn_pasta.setBounds(30, 220, 180, 50); btn_showBill.setBackground(new java.awt.Color(255, 255, 255)); btn_showBill.setFont(new java.awt.Font("Rockwell", 1, 24)); // NOI18N btn_showBill.setForeground(new java.awt.Color(102, 0, 102)); btn_showBill.setText("Finish and show bill"); btn_showBill.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR)); btn_showBill.setPreferredSize(new java.awt.Dimension(180, 50)); btn_showBill.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btn_showBillActionPerformed(evt); } }); pnl_background.add(btn_showBill); btn_showBill.setBounds(810, 680, 310, 50); btn_burgers.setBackground(new java.awt.Color(255, 255, 255)); btn_burgers.setFont(new java.awt.Font("Rockwell", 1, 24)); // NOI18N btn_burgers.setForeground(new java.awt.Color(102, 0, 102)); btn_burgers.setText("Burgers"); btn_burgers.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR)); btn_burgers.setPreferredSize(new java.awt.Dimension(180, 50)); btn_burgers.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btn_burgersActionPerformed(evt); } }); pnl_background.add(btn_burgers); btn_burgers.setBounds(30, 310, 180, 50); btn_drinks.setBackground(new java.awt.Color(255, 255, 255)); btn_drinks.setFont(new java.awt.Font("Rockwell", 1, 24)); // NOI18N btn_drinks.setForeground(new java.awt.Color(102, 0, 102)); btn_drinks.setText("Drinks"); btn_drinks.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR)); btn_drinks.setPreferredSize(new java.awt.Dimension(180, 50)); btn_drinks.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btn_drinksActionPerformed(evt); } }); pnl_background.add(btn_drinks); btn_drinks.setBounds(30, 580, 180, 50); btn_stillOrdering.setBackground(new java.awt.Color(255, 255, 255)); btn_stillOrdering.setFont(new java.awt.Font("Rockwell", 1, 24)); // NOI18N btn_stillOrdering.setForeground(new java.awt.Color(102, 0, 102)); btn_stillOrdering.setText("Add this food"); btn_stillOrdering.setToolTipText(""); btn_stillOrdering.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR)); btn_stillOrdering.setPreferredSize(new java.awt.Dimension(180, 50)); btn_stillOrdering.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btn_stillOrderingActionPerformed(evt); } }); pnl_background.add(btn_stillOrdering); btn_stillOrdering.setBounds(450, 680, 230, 50); cbx_promoCode.setFont(new java.awt.Font("Rockwell", 0, 24)); // NOI18N pnl_background.add(cbx_promoCode); cbx_promoCode.setBounds(630, 500, 430, 60); cbx_choose_order.setFont(new java.awt.Font("Rockwell", 0, 24)); // NOI18N cbx_choose_order.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" })); pnl_background.add(cbx_choose_order); cbx_choose_order.setBounds(620, 230, 430, 60); spin_quantity.setFont(new java.awt.Font("Rockwell", 0, 24)); // NOI18N spin_quantity.setModel(new javax.swing.SpinnerNumberModel(1, 1, 10, 1)); spin_quantity.setAutoscrolls(true); spin_quantity.setEditor(new javax.swing.JSpinner.NumberEditor(spin_quantity, "")); pnl_background.add(spin_quantity); spin_quantity.setBounds(700, 380, 130, 50); btn_appetizers1.setBackground(new java.awt.Color(255, 255, 255)); btn_appetizers1.setFont(new java.awt.Font("Rockwell", 1, 24)); // NOI18N btn_appetizers1.setForeground(new java.awt.Color(102, 0, 102)); btn_appetizers1.setText("Appetizers"); btn_appetizers1.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR)); btn_appetizers1.setPreferredSize(new java.awt.Dimension(180, 50)); btn_appetizers1.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btn_appetizers1ActionPerformed(evt); } }); pnl_background.add(btn_appetizers1); btn_appetizers1.setBounds(30, 130, 180, 50); btn_desserts1.setBackground(new java.awt.Color(255, 255, 255)); btn_desserts1.setFont(new java.awt.Font("Rockwell", 1, 24)); // NOI18N btn_desserts1.setForeground(new java.awt.Color(102, 0, 102)); btn_desserts1.setText("Desserts"); btn_desserts1.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR)); btn_desserts1.setPreferredSize(new java.awt.Dimension(180, 50)); btn_desserts1.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btn_desserts1ActionPerformed(evt); } }); pnl_background.add(btn_desserts1); btn_desserts1.setBounds(30, 490, 180, 50); btn_offers.setBackground(new java.awt.Color(255, 255, 255)); btn_offers.setFont(new java.awt.Font("Rockwell", 1, 24)); // NOI18N btn_offers.setForeground(new java.awt.Color(102, 0, 102)); btn_offers.setText("Hot Offers"); btn_offers.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR)); btn_offers.setPreferredSize(new java.awt.Dimension(180, 50)); btn_offers.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btn_offersActionPerformed(evt); } }); pnl_background.add(btn_offers); btn_offers.setBounds(30, 670, 180, 50); lbl_promoCode.setBackground(new java.awt.Color(255, 213, 0)); lbl_promoCode.setFont(new java.awt.Font("Rockwell", 0, 36)); // NOI18N lbl_promoCode.setForeground(new java.awt.Color(255, 213, 0)); lbl_promoCode.setText("Promo Code:"); pnl_background.add(lbl_promoCode); lbl_promoCode.setBounds(330, 500, 230, 50); lbl_OrderType1.setBackground(new java.awt.Color(255, 213, 0)); lbl_OrderType1.setFont(new java.awt.Font("Rockwell", 0, 36)); // NOI18N lbl_OrderType1.setForeground(new java.awt.Color(255, 213, 0)); lbl_OrderType1.setText("Choose Item:"); pnl_background.add(lbl_OrderType1); lbl_OrderType1.setBounds(330, 240, 230, 50); lbl_quantity.setBackground(new java.awt.Color(255, 213, 0)); lbl_quantity.setFont(new java.awt.Font("Rockwell", 0, 36)); // NOI18N lbl_quantity.setForeground(new java.awt.Color(255, 213, 0)); lbl_quantity.setText("Quantity:"); pnl_background.add(lbl_quantity); lbl_quantity.setBounds(330, 370, 230, 50); lbl_order_background.setIcon(new javax.swing.ImageIcon(getClass().getResource("/customerPackage/OrderForm bg.jpg"))); // NOI18N pnl_background.add(lbl_order_background); lbl_order_background.setBounds(0, 70, 1217, 720); pHeader.setBackground(new java.awt.Color(255, 213, 0)); pHeader.setName("pHeader"); // NOI18N pHeader.setPreferredSize(new java.awt.Dimension(1062, 70)); pHeader.setLayout(null); btnLogout.setBackground(new java.awt.Color(255, 213, 0)); btnLogout.setFont(new java.awt.Font("Rockwell", 0, 24)); // NOI18N btnLogout.setForeground(new java.awt.Color(127, 72, 101)); btnLogout.setText("Log out"); btnLogout.setToolTipText(""); btnLogout.setBorder(null); btnLogout.setBorderPainted(false); btnLogout.setContentAreaFilled(false); btnLogout.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR)); btnLogout.setName(""); // NOI18N btnLogout.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnLogoutActionPerformed(evt); } }); pHeader.add(btnLogout); btnLogout.setBounds(1080, 19, 101, 40); lbLogo.setBackground(new java.awt.Color(255, 255, 255)); lbLogo.setFont(new java.awt.Font("Rockwell Condensed", 0, 52)); // NOI18N lbLogo.setForeground(new java.awt.Color(127, 72, 101)); lbLogo.setText("GUSTO"); lbLogo.setToolTipText(""); pHeader.add(lbLogo); lbLogo.setBounds(30, 10, 120, 67); btnOrdersCustomer.setBackground(new java.awt.Color(255, 213, 0)); btnOrdersCustomer.setFont(new java.awt.Font("Rockwell", 0, 24)); // NOI18N btnOrdersCustomer.setForeground(new java.awt.Color(127, 72, 101)); btnOrdersCustomer.setText("My Orders"); btnOrdersCustomer.setBorder(null); btnOrdersCustomer.setBorderPainted(false); btnOrdersCustomer.setContentAreaFilled(false); btnOrdersCustomer.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR)); btnOrdersCustomer.setPreferredSize(new java.awt.Dimension(87, 29)); btnOrdersCustomer.setRequestFocusEnabled(false); btnOrdersCustomer.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnOrdersCustomerActionPerformed(evt); } }); pHeader.add(btnOrdersCustomer); btnOrdersCustomer.setBounds(901, 26, 184, 29); btnMakeOrderCustomer.setBackground(new java.awt.Color(255, 213, 0)); btnMakeOrderCustomer.setFont(new java.awt.Font("Rockwell", 0, 24)); // NOI18N btnMakeOrderCustomer.setForeground(new java.awt.Color(127, 72, 101)); btnMakeOrderCustomer.setText("Make Order"); btnMakeOrderCustomer.setBorder(null); btnMakeOrderCustomer.setBorderPainted(false); btnMakeOrderCustomer.setContentAreaFilled(false); btnMakeOrderCustomer.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR)); btnMakeOrderCustomer.setPreferredSize(new java.awt.Dimension(87, 29)); btnMakeOrderCustomer.setRequestFocusEnabled(false); btnMakeOrderCustomer.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnMakeOrderCustomerActionPerformed(evt); } }); pHeader.add(btnMakeOrderCustomer); btnMakeOrderCustomer.setBounds(750, 20, 170, 40); btnMenuCustomer.setBackground(new java.awt.Color(255, 213, 0)); btnMenuCustomer.setFont(new java.awt.Font("Rockwell", 0, 24)); // NOI18N btnMenuCustomer.setForeground(new java.awt.Color(127, 72, 101)); btnMenuCustomer.setText("Main Menu"); btnMenuCustomer.setBorder(null); btnMenuCustomer.setBorderPainted(false); btnMenuCustomer.setContentAreaFilled(false); btnMenuCustomer.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR)); btnMenuCustomer.setPreferredSize(new java.awt.Dimension(87, 29)); btnMenuCustomer.setRequestFocusEnabled(false); btnMenuCustomer.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnMenuCustomerActionPerformed(evt); } }); pHeader.add(btnMenuCustomer); btnMenuCustomer.setBounds(430, 20, 153, 40); btnBestSellersCustomer.setBackground(new java.awt.Color(255, 213, 0)); btnBestSellersCustomer.setFont(new java.awt.Font("Rockwell", 0, 24)); // NOI18N btnBestSellersCustomer.setForeground(new java.awt.Color(127, 72, 101)); btnBestSellersCustomer.setText("Best Selling"); btnBestSellersCustomer.setBorder(null); btnBestSellersCustomer.setBorderPainted(false); btnBestSellersCustomer.setContentAreaFilled(false); btnBestSellersCustomer.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR)); btnBestSellersCustomer.setPreferredSize(new java.awt.Dimension(87, 29)); btnBestSellersCustomer.setRequestFocusEnabled(false); btnBestSellersCustomer.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnBestSellersCustomerActionPerformed(evt); } }); pHeader.add(btnBestSellersCustomer); btnBestSellersCustomer.setBounds(590, 20, 153, 40); pnl_background.add(pHeader); pHeader.setBounds(0, 0, 1220, 80); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(pnl_background, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(pnl_background, javax.swing.GroupLayout.DEFAULT_SIZE, 788, Short.MAX_VALUE) ); pack(); }// </editor-fold>//GEN-END:initComponents private void btn_pizzaActionPerformed(java.awt.event.ActionEvent evt) {//GEN- evt) {//GEN- FIRST:event_btn_pizzaActionPerformed // TODO add your handling code here: category = btn_pizza.getText(); fillComboBox("Pizza"); }//GEN-LAST:event_btn_pizzaActionPerformed private void btn_pastaActionPerformed(java.awt.event.ActionEvent FIRST:event_btn_pastaActionPerformed // TODO add your handling code here: category = btn_pasta.getText(); fillComboBox("Pasta"); }//GEN-LAST:event_btn_pastaActionPerformed private void btn_showBillActionPerformed(java.awt.event.ActionEvent evt) {//GEN- evt) {//GEN- evt) {//GEN- FIRST:event_btn_showBillActionPerformed ShowOrders s = new ShowOrders(customer, menuIds); s.setVisible(true); this.dispose(); }//GEN-LAST:event_btn_showBillActionPerformed private void btn_burgersActionPerformed(java.awt.event.ActionEvent FIRST:event_btn_burgersActionPerformed // TODO add your handling code here: category = btn_burgers.getText(); fillComboBox("Burger"); }//GEN-LAST:event_btn_burgersActionPerformed private void btn_drinksActionPerformed(java.awt.event.ActionEvent FIRST:event_btn_drinksActionPerformed // TODO add your handling code here: category = btn_drinks.getText(); fillComboBox("Drinks"); }//GEN-LAST:event_btn_drinksActionPerformed private void btn_stillOrderingActionPerformed(java.awt.event.ActionEvent evt) {//GENFIRST:event_btn_stillOrderingActionPerformed boolean success = new myOrderFunctions().placeOrder(customer.getId(), customer.getName(), customer.getMobilePhone(), cbx_choose_order.getSelectedItem().toString(), (Integer) spin_quantity.getValue()); if (success) { JOptionPane.showMessageDialog(this, "Item added Successfully", "Success", JOptionPane.INFORMATION_MESSAGE); } else { JOptionPane.showMessageDialog(this, "Pls Try again", "Error", JOptionPane.ERROR_MESSAGE); } }//GEN-LAST:event_btn_stillOrderingActionPerformed private void btn_appetizers1ActionPerformed(java.awt.event.ActionEvent evt) {//GENFIRST:event_btn_appetizers1ActionPerformed // TODO add your handling code here: category = btn_appetizers1.getText(); fillComboBox("Appetizers"); }//GEN-LAST:event_btn_appetizers1ActionPerformed private void btn_desserts1ActionPerformed(java.awt.event.ActionEvent evt) {//GENFIRST:event_btn_desserts1ActionPerformed // TODO add your handling code here: category = btn_desserts1.getText(); fillComboBox("Desserts"); }//GEN-LAST:event_btn_desserts1ActionPerformed private void btn_offersActionPerformed(java.awt.event.ActionEvent evt) {//GEN- FIRST:event_btn_offersActionPerformed // TODO add your handling code here: cbx_choose_order.setModel(new DefaultComboBoxModel<>(new String[]{ "" })); for (int i = 0; i < HomepageForm.offers.size(); ++i) { cbx_choose_order.addItem(HomepageForm.offers.get(i).getMessage()); orderPrice.put(HomepageForm.offers.get(i).getMessage(), HomepageForm.offers.get(i).getPrice()); } }//GEN-LAST:event_btn_offersActionPerformed private void btn_orderStatusActionPerformed(java.awt.event.ActionEvent evt) {//GENFIRST:event_btn_orderStatusActionPerformed ShowOrders s = new ShowOrders(customer, menuIds); s.setVisible(true); this.dispose(); }//GEN-LAST:event_btn_orderStatusActionPerformed /** * Force-inserts line breaks into an otherwise human-unfriendly long string. * */ private String breakLongString(String input, int charLimit) { String output = "", rest = input; int i = 0; // validate. if (rest.length() < charLimit) { output = rest; } else if (!rest.equals("") && (rest != null)) // safety precaution { do { // search the next index of interest. i = rest.lastIndexOf(" ", charLimit) + 1; if (i == -1) { i = charLimit; } if (i > rest.length()) { i = rest.length(); } // break! output += rest.substring(0, i) + "\n"; rest = rest.substring(i); } while ((rest.length() > charLimit)); output += rest; } return output; } private void btnLogoutActionPerformed(java.awt.event.ActionEvent evt) {//GEN- FIRST:event_btnLogoutActionPerformed HomepageForm homepage = new HomepageForm(true); homepage.setVisible(true); this.dispose(); }//GEN-LAST:event_btnLogoutActionPerformed private void btnOrdersCustomerActionPerformed(java.awt.event.ActionEvent evt) {//GENFIRST:event_btnOrdersCustomerActionPerformed ShowOrders s = new ShowOrders(customer, menuIds); s.setVisible(true); this.dispose(); }//GEN-LAST:event_btnOrdersCustomerActionPerformed private void btnMakeOrderCustomerActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnMakeOrderCustomerActionPerformed // TODO add your handling code here: OrderForm o = new OrderForm(customer, menuIds); o.setVisible(true); this.dispose(); }//GEN-LAST:event_btnMakeOrderCustomerActionPerformed private void btnMenuCustomerActionPerformed(java.awt.event.ActionEvent evt) {//GENFIRST:event_btnMenuCustomerActionPerformed Menu m = new Menu(); m.setVisible(true); }//GEN-LAST:event_btnMenuCustomerActionPerformed private void btnBestSellersCustomerActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnBestSellersCustomerActionPerformed BestSellerForm b = new BestSellerForm(customer, menuIds); b.setVisible(true); this.dispose(); }//GEN-LAST:event_btnBestSellersCustomerActionPerformed /** * @param args the command line arguments */ public static void main(String args[]) { /* Set the Nimbus look and feel */ //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) "> /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel. * For details http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html */ try { see for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) { if ("Nimbus".equals(info.getName())) { javax.swing.UIManager.setLookAndFeel(info.getClassName()); break; } } } catch (ClassNotFoundException ex) { java.util.logging.Logger.getLogger(OrderForm.class.getName()).log(java.util.logging.Level.SEV ERE, null, ex); } catch (InstantiationException ex) { java.util.logging.Logger.getLogger(OrderForm.class.getName()).log(java.util.logging.Level.SEV ERE, null, ex); } catch (IllegalAccessException ex) { java.util.logging.Logger.getLogger(OrderForm.class.getName()).log(java.util.logging.Level.SEV ERE, null, ex); } catch (javax.swing.UnsupportedLookAndFeelException ex) { java.util.logging.Logger.getLogger(OrderForm.class.getName()).log(java.util.logging.Level.SEV ERE, null, ex); } //</editor-fold> //</editor-fold> /* Create and display the form */ java.awt.EventQueue.invokeLater(new Runnable() { public void run() { new OrderForm().setVisible(true); } }); } // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JButton btnBestSellersCustomer; private javax.swing.JButton btnLogout; private javax.swing.JButton btnMakeOrderCustomer; private javax.swing.JButton btnMenuCustomer; private javax.swing.JButton btnOrdersCustomer; private javax.swing.JButton btn_appetizers1; private javax.swing.JButton btn_burgers; private javax.swing.JButton btn_desserts1; private javax.swing.JButton btn_drinks; private javax.swing.JButton btn_offers; private javax.swing.JButton btn_orderStatus; private javax.swing.JButton btn_pasta; private javax.swing.JButton btn_pizza; private javax.swing.JButton btn_showBill; private javax.swing.JButton btn_stillOrdering; private javax.swing.JComboBox<String> cbx_choose_order; private javax.swing.JComboBox<String> cbx_promoCode; private javax.swing.JLabel lbLogo; private javax.swing.JLabel lbl_OrderType1; private javax.swing.JLabel lbl_order_background; private javax.swing.JLabel lbl_promoCode; private javax.swing.JLabel lbl_quantity; public static javax.swing.JPanel pHeader; private javax.swing.JPanel pnl_background; private javax.swing.JSpinner spin_quantity; // End of variables declaration//GEN-END:variables } 22. Order: /* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package customerPackage; import gustorestaurant.MyConnection; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import java.text.DateFormat; import java.text.ParseException; import java.text.SimpleDateFormat; import java.time.Instant; import java.util.Date; import java.util.HashMap; import java.util.logging.Level; import java.util.logging.Logger; import javax.swing.JOptionPane; /** * * @author ishik */ public class Order { private String Id; private String complainMessage; private String customerId; private String customerName; private String customerMobile; private String customerAddress; //private Date deliveryTime; private String associatedWaiterId; protected HashMap<String, Integer> orderList = new HashMap<>(); public HashMap<String, Double> ratings = new HashMap<>(); DateFormat dateFormat = new SimpleDateFormat("h:mm aa"); private boolean voucherFound = false; boolean assigned = false; //private Date orderStartTime; private long CanelTimeInMillis = (60000 * 0); private long startTimeInMillis = (60000 * 0); private long servedTimeInMillis = (60000 * 0); private boolean status = false; public Order(String Id, String customerId, String customerName, String customerAddress, String customerMobile) { this.Id = Id; this.customerId = customerId; this.customerName = customerName; this.customerAddress = customerAddress; this.customerMobile = customerMobile; } public static int getNoOrders() //for genearting id numbers of new orders { int count = 0; try { PreparedStatement preparedStmt MyConnection.getConnection().prepareStatement("SELECT menu_item.order_info"); ResultSet rs = preparedStmt.executeQuery(); = count(*) FROM if (rs.next()) { count = rs.getInt("count(*)"); } } catch (SQLException ex) { Logger.getLogger(Order.class.getName()).log(Level.SEVERE, null, ex); } return count; } public Order() { } public Order(String Id) { this.Id = Id; } public void setAssociatedWaiterId(String associatedWaiterId) { this.associatedWaiterId = associatedWaiterId; } public void setOrderList(HashMap<String, Integer> orderList) { this.orderList = orderList; } public void setCanelTimeInMillis(long CanelTimeInMillis) { this.CanelTimeInMillis = CanelTimeInMillis; } public void setId(String Id) { this.Id = Id; } public void setservedTimeInMillis(long servedTimeInMillis) { this.servedTimeInMillis = servedTimeInMillis; } public long getDeliveryTimeInMillis() { return servedTimeInMillis; } public void setStartTimeInMillis(long startTimeInMillis) { this.startTimeInMillis = startTimeInMillis; } public long getStartTimeInMillis() { return startTimeInMillis; } public boolean isVoucherFound() { return voucherFound; } public void setVoucherFound(boolean voucherFound) { this.voucherFound = voucherFound; } public void setComplainMessage(String complainMessage) { this.complainMessage = complainMessage; } public void setStatus(boolean status) { this.status = status; } public String getAssociatedWaiterId() { return associatedWaiterId; } // public Date getOrderStartTime() // { // return orderStartTime; // } public String getId() { return Id; } // public Date getDeliveryTime() // { // return deliveryTime; // } public long getCanelTimeInMillis() { return CanelTimeInMillis; } public String getComplainMessage() { return complainMessage; } static public boolean checkStatus(Order order) { //Date currentTime = new Date(); long currentTime = System.currentTimeMillis(); //long ONE_MINUTE_IN_MILLIS = 60000; if (order.getDeliveryTimeInMillis()<=currentTime/*currentTime.after(order.getDeliveryTime()) || currentTime.equals(order.getDeliveryTime())*/) { order.setStatus(true); } return order.getStatus(); } public boolean getStatus() { return status; } public void writeNewOrder(String orderIds) { //boolean isEmptyList = false; // String start = (String) dateFormat.format(orderStartTime); // String duration = dateFormat.format(deliveryTime); String menuItemsIds = ""; //Add the new order to order_info table in data base try { //Add new added item into database in menu_item table String query = "INSERT order_cutomerName,order_StartMillis order_complainMessage , INTO order_info ,order_waiter, order_menuItemList , ( order_id, order_receivedStatus order_servedMillis )" , + " VALUES(?,?,?,?,?,?,?,?)"; PreparedStatement preparedStmt MyConnection.getConnection().prepareStatement(query); preparedStmt.setInt(1, Integer.valueOf(Id)); preparedStmt.setString(2, customerName); preparedStmt.setLong(3, startTimeInMillis); preparedStmt.setString(4, associatedWaiterId); preparedStmt.setBoolean(5, status); //preparedStmt.setString(5, String.valueOf(status)); preparedStmt.setString(6, complainMessage); //take the ordered food items ids from the inventoryList map in a string for (String foodItem : orderList.keySet()) { menuItemsIds += String.valueOf(foodItem); menuItemsIds += "#"; menuItemsIds += String.valueOf(orderList.get(foodItem)); menuItemsIds += "&"; } menuItemsIds = menuItemsIds.substring(0, menuItemsIds.length() - 1); preparedStmt.setString(7, menuItemsIds); preparedStmt.setLong(8, servedTimeInMillis); //preparedStmt.setLong(9, startTimeInMillis); = preparedStmt.execute(); } catch (SQLException ex) { Logger.getLogger(Order.class.getName()).log(Level.SEVERE, null, ex); } //Add the new order id to the list of order ids try { //Add new added item into database in menu_item table if (orderIds == null) { //write the order id as string in the data base orderIds = Id; } else { orderIds += "/" + Id; } /*String query = "UPDATE customer SET customer_listOfOrders='" + orderIds + "'" + " WHERE customer_name =" + customerName + ""; PreparedStatement preparedStmt MyConnection.getConnection().prepareStatement(query); preparedStmt.execute();*/ System.out.println(customerId+" "+Integer.valueOf(customerId)); String query = "UPDATE customer SET customer_listOfOrders = '" + orderIds = + "' WHERE customer_id = " + Integer.valueOf(customerId); PreparedStatement preparedStmt = MyConnection.getConnection().prepareStatement(query); preparedStmt.execute(); } catch (SQLException ex) { Logger.getLogger(Order.class.getName()).log(Level.SEVERE, null, ex); } } public void updateOrder(Order order) { try { System.out.println(order.getId()+" "+Integer.valueOf(Id)+" in updateorders fun"); String query = "UPDATE order_info SET order_receivedStatus = " + order.getStatus() + " WHERE order_id = " + Integer.valueOf(order.getId()); PreparedStatement preparedStmt MyConnection.getConnection().prepareStatement(query); preparedStmt.execute(); } catch (SQLException ex) { Logger.getLogger(Order.class.getName()).log(Level.SEVERE, null, ex); } } void updateWaiters(Waiter waiter) = { int status; try { System.out.println(waiter.getOrdersList().size()+" "+waiter.isAvailable()+" we are in update function"); if (waiter.isAvailable()) { status = 1; } else { status = 0; } System.out.println(status+" we are in update function"); if (waiter.getOrdersList().isEmpty()) { String Query = " UPDATE menu_item.waiters SET status_waiters=" + waiter.isAvailable() + ",order1_waiters = " + null + ",order2_waiters =" + null + " WHERE id_waiters =" + waiter.getId() + ""; PreparedStatement preparedStmt MyConnection.getConnection().prepareStatement(Query); preparedStmt.execute(); = } else if (waiter.getOrdersList().size() == 1) { String Query = " UPDATE menu_item.waiters SET status_waiters=" + waiter.isAvailable() + ",order1_waiters = " + waiter.getOrdersList().get(0).Id + ",order2_waiters =" + null + " WHERE id_waiters =" + waiter.getId() + ""; PreparedStatement preparedStmt = MyConnection.getConnection().prepareStatement(Query); preparedStmt.execute(); } else if (waiter.getOrdersList().size() == 2) { String Query = " UPDATE menu_item.waiters SET status_waiters=" + waiter.isAvailable() + ",order1_waiters = " + waiter.getOrdersList().get(0).Id + ",order2_waiters =" + waiter.getOrdersList().get(1).Id + " WHERE id_waiters =" + waiter.getId() + ""; PreparedStatement preparedStmt MyConnection.getConnection().prepareStatement(Query); preparedStmt.execute(); } } catch (SQLException ex) = { Logger.getLogger(Order.class.getName()).log(Level.SEVERE, null, ex); } } boolean assignOrder() { try { Date currentTime = new Date(); String Now = dateFormat.format(currentTime/*Date.from(Instant.now())*/); Date now = dateFormat.parse(Now); for (String waiterId : Waiter.waiterList.keySet()) { System.out.println(assigned+" "+Waiter.waiterList.get(waiterId).getOrdersList().size()+" "+Waiter.waiterList.get(waiterId).getName()+" "+dateFormat.format(Waiter.waiterList.get(waiterId).getStart())+" "+now+" "+dateFormat.format(Waiter.waiterList.get(waiterId).getEnd())+" in assign function"); if ((!assigned) && (Waiter.waiterList.get(waiterId).getStart().before(now) Waiter.waiterList.get(waiterId).getStart().equals(now)) Waiter.waiterList.get(waiterId).getEnd().after(now)) // we can add { || && if (Waiter.waiterList.get(waiterId).isAvailable()) { assigned = true; Waiter.waiterList.get(waiterId).getOrdersList().add(this); associatedWaiterId = waiterId; if (Waiter.waiterList.get(waiterId).getOrdersList().size() == Waiter.maxOrders) { Waiter.waiterList.get(waiterId).setAvailable(false); } if (assigned) { System.out.println(assigned+" "+Waiter.waiterList.get(waiterId).getOrdersList().size()+" "+Waiter.waiterList.get(waiterId).isAvailable()+" in assign function"); break; } } } } if (!assigned) { JOptionPane.showMessageDialog(null, "We are so sorry but there is no service available for now.\nTry to order after a while."); } } catch (ParseException ex) { Logger.getLogger(Order.class.getName()).log(Level.SEVERE, null, ex); } return assigned; } } 23. MyOrder: /* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package customerPackage; import static customerPackage.OrderForm.customer; import gustorestaurant.MyConnection; import gustorestaurant.User; import java.awt.List; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import java.util.ArrayList; import java.util.logging.Level; import java.util.logging.Logger; import javax.swing.JOptionPane; import starting.LoginForm; /** * * @author Sahil */ public class myOrderFunctions { public boolean placeOrder(int id, String cus_name, String cus_mobile, String menu_item_name, int order_menuItemQuantity) { boolean inserted = false; String cookedStatus = "Cooking"; String receievedStatus = "Pending"; try { ArrayList menu_data = getMenu(menu_item_name); if (menu_data.isEmpty()) { System.out.println("customerPackage.myOrderFunctions.placeOrder() Menu Data not found" + menu_item_name); } else { String query = "INSERT INTO cus_order_info (order_customerId, order_customerName,order_customerMobile, order_menuItemId, order_menuItemPrice,order_menuItemName, order_cookedStatus, order_receivedStatus,order_menuItemQuantity ) " + " VALUES(?,?,?,?,?,?,?,?,?)"; PreparedStatement preparedStmt MyConnection.getConnection().prepareStatement(query); preparedStmt.setInt(1, Integer.valueOf(id)); preparedStmt.setString(2, cus_name); preparedStmt.setLong(3, Long.parseLong(cus_mobile)); preparedStmt.setInt(4, (Integer) menu_data.get(0)); preparedStmt.setInt(5, (Integer) menu_data.get(1)); preparedStmt.setString(6, menu_item_name); preparedStmt.setString(7, cookedStatus); preparedStmt.setString(8, receievedStatus); preparedStmt.setInt(9, order_menuItemQuantity); preparedStmt.execute(); preparedStmt.closeOnCompletion(); inserted = true; } } catch (Exception e) { e.printStackTrace(); } return inserted; = } public ArrayList getMenu(String menu_name) { ArrayList menu_data = new ArrayList(); PreparedStatement ps; ResultSet rs; String query = "SELECT idmenu_item,pricemenu_item, category FROM menu_item WHERE namemenu_item = ? ;"; try { ps = MyConnection.getConnection().prepareStatement(query); ps.setString(1, menu_name); rs = ps.executeQuery(); ps.closeOnCompletion(); if (rs.next()) { System.out.println(rs.toString()); menu_data.add(rs.getInt("idmenu_item")); menu_data.add(rs.getInt("pricemenu_item")); menu_data.add(rs.getString("category")); } } catch (Exception e) { e.printStackTrace(); } return menu_data; } public ArrayList<CusOrder> getOrdersByCusId(int cus_id) { ArrayList<CusOrder> order_data = new ArrayList(); PreparedStatement ps; ResultSet rs; String query = "SELECT * FROM cus_order_info WHERE order_customerId = ? ;"; try { ps = MyConnection.getConnection().prepareStatement(query); ps.setInt(1, cus_id); rs = ps.executeQuery(); ps.closeOnCompletion(); while (rs.next()) { CusOrder cusOrder = new CusOrder(); cusOrder.setOrder_customerId(rs.getInt("order_customerId")); cusOrder.setOrder_customerMobile(rs.getString("order_customerMobile")); cusOrder.setOrder_cookedStatus(rs.getString("order_cookedStatus")); cusOrder.setOrder_customerName(rs.getString("order_customerName")); cusOrder.setOrder_menuItemId(rs.getInt("order_menuItemId")); cusOrder.setOrder_menuItemName(rs.getString("order_menuItemName")); cusOrder.setOrder_menuItemPrice(rs.getInt("order_menuItemPrice")); cusOrder.setOrder_menuItemQuantity(rs.getInt("order_menuItemQuantity")); cusOrder.setOrder_receivedStatus(rs.getString("order_receivedStatus")); order_data.add(cusOrder); } return order_data; } catch (Exception e) { e.printStackTrace(); } return order_data; } public ArrayList<CusOrder> getAllOrders() { ArrayList<CusOrder> order_data = new ArrayList(); PreparedStatement ps; ResultSet rs; String query = "SELECT * FROM cus_order_info WHERE order_cookedStatus=?;"; try { ps = MyConnection.getConnection().prepareStatement(query); ps.setString(1, "Cooking"); rs = ps.executeQuery(); ps.closeOnCompletion(); while (rs.next()) { CusOrder cusOrder = new CusOrder(); cusOrder.setOrderId(rs.getInt("order_id")); cusOrder.setOrder_customerId(rs.getInt("order_customerId")); cusOrder.setOrder_customerMobile(rs.getString("order_customerMobile")); cusOrder.setOrder_cookedStatus(rs.getString("order_cookedStatus")); cusOrder.setOrder_customerName(rs.getString("order_customerName")); cusOrder.setOrder_menuItemId(rs.getInt("order_menuItemId")); cusOrder.setOrder_menuItemName(rs.getString("order_menuItemName")); cusOrder.setOrder_menuItemPrice(rs.getInt("order_menuItemPrice")); cusOrder.setOrder_menuItemQuantity(rs.getInt("order_menuItemQuantity")); cusOrder.setOrder_receivedStatus(rs.getString("order_receivedStatus")); order_data.add(cusOrder); } return order_data; } catch (Exception e) { e.printStackTrace(); } return order_data; } public boolean updateOrder(int OrderId) { boolean updated = false; String coocked = "Served"; try { String query = "UPDATE cus_order_info SET order_cookedStatus=? WHERE order_id=?"; PreparedStatement preparedStmt MyConnection.getConnection().prepareStatement(query); preparedStmt.setString(1, "Served"); preparedStmt.setInt(2, OrderId); preparedStmt.execute(); preparedStmt.closeOnCompletion(); updated = true; } catch (Exception e) { e.printStackTrace(); } return updated; } } 24. CustomerOrder: /* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ = package customerPackage; /** * * @author Sahil */ public class CusOrder { private int orderId; private int order_customerId; private String order_customerName; private String order_customerMobile; private int order_menuItemId; private int order_menuItemPrice; private String order_menuItemName; private int order_menuItemQuantity; private String order_cookedStatus; private String order_receivedStatus; public int getOrder_customerId() { return order_customerId; } public void setOrder_customerId(int order_customerId) { this.order_customerId = order_customerId; } public String getOrder_customerName() { return order_customerName; } public void setOrder_customerName(String order_customerName) { this.order_customerName = order_customerName; } public String getOrder_customerMobile() { return order_customerMobile; } public void setOrder_customerMobile(String order_customerMobile) { this.order_customerMobile = order_customerMobile; } public int getOrder_menuItemId() { return order_menuItemId; } public void setOrder_menuItemId(int order_menuItemId) { this.order_menuItemId = order_menuItemId; } public int getOrder_menuItemPrice() { return order_menuItemPrice; } public void setOrder_menuItemPrice(int order_menuItemPrice) { this.order_menuItemPrice = order_menuItemPrice; } public String getOrder_menuItemName() { return order_menuItemName; } public void setOrder_menuItemName(String order_menuItemName) { this.order_menuItemName = order_menuItemName; } public int getOrder_menuItemQuantity() { return order_menuItemQuantity; } public void setOrder_menuItemQuantity(int order_menuItemQuantity) { this.order_menuItemQuantity = order_menuItemQuantity; } public String getOrder_cookedStatus() { return order_cookedStatus; } public void setOrder_cookedStatus(String order_cookedStatus) { this.order_cookedStatus = order_cookedStatus; } public String getOrder_receivedStatus() { return order_receivedStatus; } public void setOrder_receivedStatus(String order_receivedStatus) { this.order_receivedStatus = order_receivedStatus; } public int getOrderId() { return orderId; } public void setOrderId(int orderId) { this.orderId = orderId; } } 25. BillForm: package customerPackage; /* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ import customerPackage.OrderForm.*; import customerPackage.OrderForm; import customerPackage.Order_Table; import java.text.DateFormat; import java.text.SimpleDateFormat; import java.util.*; import javafx.util.Pair; import javax.swing.DefaultComboBoxModel; import javax.swing.JFrame; import javax.swing.JOptionPane; import javax.swing.JPanel; import menuItems.Inventory; /** * * @author ishik */ public class BillForm extends javax.swing.JFrame { //Order order = new Order(); Bill bill; String ordersS; int totalCash; int rate; static boolean returned = false; Voucher exceed1000 = new Voucher("Exceed1000", 20); boolean rated=false; boolean pressedStatusBtn=false; static boolean served=false; /** * Creates new form BillForm */ public BillForm() { initComponents(); pnl_rate.setVisible(false); pnl_bill.setVisible(true); lbl_complain.setVisible(false); txt_complainMessege.setVisible(false); btn_closeRating.setVisible(false); } public BillForm(HashMap<String, Integer> tempOrderList, Voucher voucher, String s) { initComponents(); cbx_ChooseItemToRate.setModel(new DefaultComboBoxModel<>(new String[] { "" })); totalCash = 0; ordersS=s; System.out.println(ordersS); pnl_bill.setVisible(true); pnl_rate.setVisible(false); //Compalin part lbl_complain.setVisible(false); txt_complainMessege.setVisible(false); btn_closeRating.setVisible(false); DateFormat dateFormat = new SimpleDateFormat("dd MMM yyyy, hh:mm aa"); Date currentDate = new Date(); txtArea_bill.setText("\n ******GUSTO****** \n\n"); txtArea_bill.append("Date: " + dateFormat.format(currentDate) + "\n\n"); txtArea_bill.append("PRICE QTY TOTAL\n"); txtArea_bill.append("__________________________________________\n"); tempOrderList.keySet().forEach((String foodItem) -> { cbx_ChooseItemToRate.addItem(foodItem); totalCash += OrderForm.orderPrice.get(foodItem) * tempOrderList.get(foodItem); txtArea_bill.append(foodItem + "\n"); txtArea_bill.append("EGP" + OrderForm.orderPrice.get(foodItem) + " tempOrderList.get(foodItem) + " tempOrderList.get(foodItem) + "\n\n"); }); " + EGP" + OrderForm.orderPrice.get(foodItem) * txtArea_bill.append("Total Cash: " + totalCash + "\n"); bill = new Bill(totalCash, dateFormat.format(currentDate), "5"); //If the customer didn't choose a promo code and his bill xceed 1000 -> he takes the offer if (totalCash > 1000 && !OrderForm.currentOrder.isVoucherFound()) { totalCash = bill.getDiscount(exceed1000.getPercentage()); displayVoucher(exceed1000, totalCash); } //If the customer choose a promo code if (OrderForm.currentOrder.isVoucherFound()) { //if the voucher he chose was Exceed1000 and his bill actually exceeds 1000 -> he gets the voucher if (totalCash > 1000 && voucher.getId().equals("Exceed1000")) { totalCash = bill.getDiscount(voucher.getPercentage()); displayVoucher(voucher, totalCash); } //The voucher he chose was Exceed1000 and his bill doesn't exceed 1000 -> he doesn't get the voucher else if (totalCash < 1000 && voucher.getId().equals("Exceed1000")) { JOptionPane.showMessageDialog(this, "You can't proceed with this voucher as your bill is below 1000", "Error", JOptionPane.ERROR_MESSAGE); txtArea_bill.append("Total Cash after discount: " + totalCash + "\n"); } //His bill exceeds 1000 but he didn't choose the Exceed1000 voucher -> he chooses which voucher he wants to proceed with else if (totalCash > 1000 && !voucher.getId().equals("Exceed1000")) { int choice = JOptionPane.showConfirmDialog(this, "Your bill has exceeded 1000.Would you like to take the Exceed1000 voucher?"); //Yes choice -> gets the Exceed1000 voucher if (choice == 0) { totalCash = bill.getDiscount(exceed1000.getPercentage()); displayVoucher(voucher, totalCash); } //No -> gets he desired voucher else { totalCash = bill.getDiscount(voucher.getPercentage()); displayVoucher(voucher, totalCash); } } //his bill is below 1000 and he didn't choose the Exceed1000 voucher -> proceeds with the chosen voucher else { totalCash = bill.getDiscount(voucher.getPercentage()); displayVoucher(voucher, totalCash); } } txtArea_bill.append("\n Thank you for visiting Gusto\n"); txtArea_bill.append("\n*******************************************\n"); } /** * This method is called from within the constructor to initialize the form. * WARNING: Do NOT modify this code. The content of this method is always * regenerated by the Form Editor. */ @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated BEGIN:initComponents private void initComponents() { pnl_bill = new javax.swing.JPanel(); pnl_rate = new javax.swing.JPanel(); cbx_ChooseItemToRate = new javax.swing.JComboBox<>(); lbl_OrderType = new javax.swing.JLabel(); lbl_rate = new javax.swing.JLabel(); btn_closeRating = new javax.swing.JButton(); lbl_complain = new javax.swing.JLabel(); txt_complainMessege = new javax.swing.JTextField(); txt_getRate = new javax.swing.JTextField(); jSeparator1 = new javax.swing.JSeparator(); Code">//GEN- btn_finishRate = new javax.swing.JButton(); btn_nextRate = new javax.swing.JButton(); btn_orderStatus = new javax.swing.JButton(); btn_backFromBill = new javax.swing.JButton(); jScrollPane1 = new javax.swing.JScrollPane(); txtArea_bill = new javax.swing.JTextArea(); btn_rate = new javax.swing.JButton(); btn_cancelOrder = new javax.swing.JButton(); setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE); setBackground(new java.awt.Color(255, 255, 255)); setLocation(new java.awt.Point(750, 100)); setMinimumSize(new java.awt.Dimension(400, 725)); setUndecorated(true); setSize(new java.awt.Dimension(400, 788)); pnl_bill.setBackground(new java.awt.Color(255, 255, 255)); pnl_bill.setLayout(null); pnl_rate.setBackground(new java.awt.Color(255, 255, 255)); pnl_rate.setName(""); // NOI18N pnl_rate.setPreferredSize(new java.awt.Dimension(400, 788)); cbx_ChooseItemToRate.setFont(new java.awt.Font("Rockwell", 0, 24)); // NOI18N cbx_ChooseItemToRate.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" })); lbl_OrderType.setBackground(new java.awt.Color(255, 213, 0)); lbl_OrderType.setFont(new java.awt.Font("Rockwell", 1, 28)); // NOI18N lbl_OrderType.setForeground(new java.awt.Color(102, 0, 102)); lbl_OrderType.setText("Choose Item:"); lbl_rate.setBackground(new java.awt.Color(255, 213, 0)); lbl_rate.setFont(new java.awt.Font("Rockwell", 1, 28)); // NOI18N lbl_rate.setForeground(new java.awt.Color(102, 0, 102)); lbl_rate.setText("Rating:"); btn_closeRating.setBackground(new java.awt.Color(255, 213, 0)); btn_closeRating.setFont(new java.awt.Font("Rockwell", 0, 24)); // NOI18N btn_closeRating.setText("Done"); btn_closeRating.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btn_closeRatingActionPerformed(evt); } }); lbl_complain.setBackground(new java.awt.Color(255, 255, 255)); lbl_complain.setFont(new java.awt.Font("Rockwell", 1, 28)); // NOI18N lbl_complain.setForeground(new java.awt.Color(102, 0, 102)); lbl_complain.setText("Is there any complains?"); lbl_complain.setPreferredSize(new java.awt.Dimension(93, 37)); txt_complainMessege.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { txt_complainMessegeActionPerformed(evt); } }); txt_getRate.setFont(new java.awt.Font("Rockwell", 0, 24)); // NOI18N btn_finishRate.setBackground(new java.awt.Color(255, 213, 0)); btn_finishRate.setFont(new java.awt.Font("Rockwell", 0, 24)); // NOI18N btn_finishRate.setText("Finish"); btn_finishRate.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btn_finishRateActionPerformed(evt); } }); btn_nextRate.setBackground(new java.awt.Color(255, 213, 0)); btn_nextRate.setFont(new java.awt.Font("Rockwell", 0, 24)); // NOI18N btn_nextRate.setText("Next"); btn_nextRate.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btn_nextRateActionPerformed(evt); } }); javax.swing.GroupLayout pnl_rateLayout = new javax.swing.GroupLayout(pnl_rate); pnl_rate.setLayout(pnl_rateLayout); pnl_rateLayout.setHorizontalGroup( pnl_rateLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(pnl_rateLayout.createSequentialGroup() .addGroup(pnl_rateLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILIN G) .addGroup(pnl_rateLayout.createSequentialGroup() .addGap(21, 21, 21) .addComponent(btn_nextRate, javax.swing.GroupLayout.PREFERRED_SIZE, 156, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(btn_finishRate, javax.swing.GroupLayout.PREFERRED_SIZE, 156, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGroup(javax.swing.GroupLayout.Alignment.LEADING, pnl_rateLayout.createSequentialGroup() .addGroup(pnl_rateLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILIN G) .addGroup(javax.swing.GroupLayout.Alignment.LEADING, pnl_rateLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) .addGroup(pnl_rateLayout.createSequentialGroup() .addGap(38, 38, 38) .addComponent(txt_complainMessege, javax.swing.GroupLayout.PREFERRED_SIZE, 320, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGroup(pnl_rateLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADIN G, false) .addComponent(jSeparator1, javax.swing.GroupLayout.Alignment.TRAILING) .addComponent(txt_getRate, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 320, Short.MAX_VALUE)) .addGroup(pnl_rateLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADIN G) .addComponent(lbl_rate, javax.swing.GroupLayout.PREFERRED_SIZE, 173, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(cbx_ChooseItemToRate, javax.swing.GroupLayout.PREFERRED_SIZE, 320, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(lbl_OrderType, javax.swing.GroupLayout.PREFERRED_SIZE, 207, javax.swing.GroupLayout.PREFERRED_SIZE))) .addGroup(javax.swing.GroupLayout.Alignment.LEADING, pnl_rateLayout.createSequentialGroup() .addGap(38, 38, 38) .addComponent(lbl_complain, javax.swing.GroupLayout.PREFERRED_SIZE, 342, javax.swing.GroupLayout.PREFERRED_SIZE))) .addGap(0, 8, Short.MAX_VALUE))) .addContainerGap()) .addGroup(pnl_rateLayout.createSequentialGroup() .addGap(100, 100, 100) .addComponent(btn_closeRating, javax.swing.GroupLayout.PREFERRED_SIZE, 156, javax.swing.GroupLayout.PREFERRED_SIZE) .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) ); pnl_rateLayout.setVerticalGroup( pnl_rateLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(pnl_rateLayout.createSequentialGroup() .addGap(28, 28, 28) .addComponent(lbl_OrderType, javax.swing.GroupLayout.PREFERRED_SIZE, 66, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(18, 18, 18) .addComponent(cbx_ChooseItemToRate, javax.swing.GroupLayout.PREFERRED_SIZE, 57, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(lbl_rate, javax.swing.GroupLayout.PREFERRED_SIZE, 66, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(27, 27, 27) .addComponent(txt_getRate, javax.swing.GroupLayout.PREFERRED_SIZE, 53, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(30, 30, 30) .addGroup(pnl_rateLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELIN E) .addComponent(btn_finishRate, javax.swing.GroupLayout.PREFERRED_SIZE, 55, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(btn_nextRate, javax.swing.GroupLayout.PREFERRED_SIZE, 55, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 70, Short.MAX_VALUE) .addComponent(jSeparator1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) 10, .addGap(47, 47, 47) .addComponent(lbl_complain, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(38, 38, 38) .addComponent(txt_complainMessege, javax.swing.GroupLayout.PREFERRED_SIZE, 53, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(46, 46, 46) .addComponent(btn_closeRating, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(51, 51, 51)) ); pnl_bill.add(pnl_rate); pnl_rate.setBounds(0, -10, 400, 820); btn_orderStatus.setBackground(new java.awt.Color(255, 213, 0)); btn_orderStatus.setFont(new java.awt.Font("Rockwell", 1, 24)); // NOI18N btn_orderStatus.setForeground(new java.awt.Color(102, 0, 102)); btn_orderStatus.setText("Order Status"); btn_orderStatus.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR)); btn_orderStatus.setPreferredSize(new java.awt.Dimension(180, 50)); btn_orderStatus.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btn_orderStatusActionPerformed(evt); } }); pnl_bill.add(btn_orderStatus); 55, btn_orderStatus.setBounds(100, 740, 190, 50); btn_backFromBill.setBackground(new java.awt.Color(255, 213, 0)); btn_backFromBill.setFont(new java.awt.Font("Rockwell", 0, 24)); // NOI18N btn_backFromBill.setText("Close"); btn_backFromBill.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR)); btn_backFromBill.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btn_backFromBillActionPerformed(evt); } }); pnl_bill.add(btn_backFromBill); btn_backFromBill.setBounds(120, 660, 150, 50); txtArea_bill.setEditable(false); txtArea_bill.setColumns(20); txtArea_bill.setFont(new java.awt.Font("Rockwell", 0, 18)); // NOI18N txtArea_bill.setRows(5); txtArea_bill.setBorder(null); jScrollPane1.setViewportView(txtArea_bill); pnl_bill.add(jScrollPane1); jScrollPane1.setBounds(0, 0, 400, 570); btn_rate.setBackground(new java.awt.Color(255, 213, 0)); btn_rate.setFont(new java.awt.Font("Rockwell", 0, 24)); // NOI18N btn_rate.setText("Rate"); btn_rate.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR)); btn_rate.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btn_rateActionPerformed(evt); } }); pnl_bill.add(btn_rate); btn_rate.setBounds(10, 580, 146, 50); btn_cancelOrder.setBackground(new java.awt.Color(255, 213, 0)); btn_cancelOrder.setFont(new java.awt.Font("Rockwell", 0, 24)); // NOI18N btn_cancelOrder.setText("Cancel Order"); btn_cancelOrder.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR)); btn_cancelOrder.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btn_cancelOrderActionPerformed(evt); } }); pnl_bill.add(btn_cancelOrder); btn_cancelOrder.setBounds(210, 580, 185, 50); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(pnl_bill, Short.MAX_VALUE) javax.swing.GroupLayout.DEFAULT_SIZE, 400, ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(pnl_bill, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 788, Short.MAX_VALUE) ); pack(); }// </editor-fold>//GEN-END:initComponents public void displayVoucher(Voucher voucher, int totalCash) { txtArea_bill.append("Total Cash after discount: " + totalCash + "\n\n"); txtArea_bill.append("Voucher ID: " + voucher.getId() + "\n"); txtArea_bill.append("Voucher discount percentage: " + voucher.getPercentage() + "\n"); } private void btn_backFromBillActionPerformed(java.awt.event.ActionEvent evt) {//GENFIRST:event_btn_backFromBillActionPerformed Inventory inventory = new Inventory(); inventory.rateItem(OrderForm.currentOrder.ratings); if (!returned) { OrderForm.currentOrder.orderList.keySet().forEach((foodItem) -> { // Subtract the sold quantity in this order from avaliableItems field in inventory int availiable = Inventory.inventoryList.get(foodItem).getAvaliableMenuItem(); availiable -= OrderForm.currentOrder.orderList.get(foodItem); Inventory.inventoryList.get(foodItem).setAvaliableMenuItem(availiable); //Add the sold quantity in this order to the soldQuantity field in inventory int sold = Inventory.inventoryList.get(foodItem).getSoldMenuItem(); sold += OrderForm.currentOrder.orderList.get(foodItem); Inventory.inventoryList.get(foodItem).setSoldMenuItem(sold); }); } // If the customer rated any fooditem if (OrderForm.currentOrder.ratings.size() > 0) { //looping over ratings map to get every rated item and add on its number of ratings OrderForm.currentOrder.ratings.keySet().forEach((foodItem) -> { // Get the current number of ratings of this food item and add 1 int ratings = Inventory.inventoryList.get(foodItem).getNumberOfRates(); ratings += 1; }); } if(!rated) { OrderForm.currentOrder.writeNewOrder(ordersS); } if(!pressedStatusBtn) { OrderForm.currentOrder.updateWaiters(OrderForm.waiter); } this.setVisible(false); }//GEN-LAST:event_btn_backFromBillActionPerformed private void btn_rateActionPerformed(java.awt.event.ActionEvent evt) {//GEN- FIRST:event_btn_rateActionPerformed // open rate panel if (OrderForm.currentOrder.getStatus()) { pnl_rate.setVisible(true); btn_rate.setVisible(false); btn_backFromBill.setVisible(false); btn_orderStatus.setVisible(false); btn_cancelOrder.setVisible(false); } else { JOptionPane.showMessageDialog(this, "Order is not served yet", "Warning", JOptionPane.WARNING_MESSAGE); } }//GEN-LAST:event_btn_rateActionPerformed private void btn_closeRatingActionPerformed(java.awt.event.ActionEvent evt) {//GENFIRST:event_btn_closeRatingActionPerformed //if a complain message was written, suggest returning order if (!txt_complainMessege.getText().equals("")) { OrderForm.currentOrder.setComplainMessage(txt_complainMessege.getText()); //if answer is yes -> remove order from the customers list of orders //if answer is no/complain message was written the order is added in data base then close the dialouge and the panel int yesNoOption = JOptionPane.showConfirmDialog(this, "Would you like to return the order?"); if (yesNoOption == 0) { OrderForm.customer.returnOrder(OrderForm.currentOrder); JOptionPane.showMessageDialog(this, successfully\nThank you for "Your your order visit", JOptionPane.INFORMATION_MESSAGE); returned = true; } else { OrderForm.currentOrder.writeNewOrder(ordersS); } } else { has been "Return returned Order", OrderForm.currentOrder.writeNewOrder(ordersS); } rated=true; pnl_rate.setVisible(false); btn_rate.setVisible(true); btn_backFromBill.setVisible(true); btn_orderStatus.setVisible(true); btn_cancelOrder.setVisible(true); }//GEN-LAST:event_btn_closeRatingActionPerformed private void txt_complainMessegeActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_txt_complainMessegeActionPerformed // TODO add your handling code here: }//GEN-LAST:event_txt_complainMessegeActionPerformed private void btn_finishRateActionPerformed(java.awt.event.ActionEvent evt) {//GENFIRST:event_btn_finishRateActionPerformed // TODO add your handling code here: if (!txt_getRate.getText().equals("")) { OrderForm.currentOrder.ratings.put(String.valueOf(cbx_ChooseItemToRate.getSelectedItem( )), Double.valueOf(txt_getRate.getText())); lbl_complain.setVisible(true); txt_complainMessege.setVisible(true); btn_closeRating.setVisible(true); } else if ("".equals(txt_getRate.getText())) { if (OrderForm.currentOrder.ratings.size() > 1) { lbl_complain.setVisible(true); txt_complainMessege.setVisible(true); btn_closeRating.setVisible(true); } else { JOptionPane.showMessageDialog(this, "Please rate at least one element", "Error", JOptionPane.ERROR_MESSAGE); } } }//GEN-LAST:event_btn_finishRateActionPerformed private void btn_nextRateActionPerformed(java.awt.event.ActionEvent evt) {//GENFIRST:event_btn_nextRateActionPerformed // TODO add your handling code here: if ("".equals(txt_getRate.getText())) { if (OrderForm.currentOrder.ratings.size() > 1) { lbl_complain.setVisible(true); txt_complainMessege.setVisible(true); btn_closeRating.setVisible(true); } else { JOptionPane.showMessageDialog(this, "Please rate at least one element", "Error", JOptionPane.ERROR_MESSAGE); } } else { OrderForm.currentOrder.ratings.put(String.valueOf(cbx_ChooseItemToRate.getSelectedItem( )), Double.valueOf(txt_getRate.getText())); txt_getRate.setText(""); } }//GEN-LAST:event_btn_nextRateActionPerformed private void btn_cancelOrderActionPerformed(java.awt.event.ActionEvent evt) {//GENFIRST:event_btn_cancelOrderActionPerformed // cancel order OrderForm.customer.cancelOrder(); }//GEN-LAST:event_btn_cancelOrderActionPerformed private void btn_orderStatusActionPerformed(java.awt.event.ActionEvent evt) {//GENFIRST:event_btn_orderStatusActionPerformed // TODO add your handling code here: if (OrderForm.currentOrder.checkStatus(OrderForm.currentOrder)) { System.out.println(OrderForm.waiter.getOrdersList().size()+" we are in the are in the orderStatusBtn"); OrderForm.waiter.getOrdersList().remove(OrderForm.currentOrder); System.out.println(OrderForm.waiter.getOrdersList().size()+" we orderStatusBtn"); OrderForm.waiter.setAvailable(true); served=true; JOptionPane.showMessageDialog(this, "Your order is done", "Served", JOptionPane.OK_OPTION); } else { JOptionPane.showMessageDialog(this, "Your order is being cooked", "Loading...", JOptionPane.OK_OPTION); } OrderForm.currentOrder.updateWaiters(OrderForm.waiter); pressedStatusBtn=true; }//GEN-LAST:event_btn_orderStatusActionPerformed /** * @param args the command line arguments */ public static void main(String args[]) { /* Set the Nimbus look and feel */ //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) "> /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel. * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html */ try { for (javax.swing.UIManager.LookAndFeelInfo info javax.swing.UIManager.getInstalledLookAndFeels()) { if ("Nimbus".equals(info.getName())) { javax.swing.UIManager.setLookAndFeel(info.getClassName()); break; } } } catch (ClassNotFoundException ex) { java.util.logging.Logger.getLogger(BillForm.class.getName()).log(java.util.logging.Level.SEVER E, null, ex); } catch (InstantiationException ex) { : java.util.logging.Logger.getLogger(BillForm.class.getName()).log(java.util.logging.Level.SEVER E, null, ex); } catch (IllegalAccessException ex) { java.util.logging.Logger.getLogger(BillForm.class.getName()).log(java.util.logging.Level.SEVER E, null, ex); } catch (javax.swing.UnsupportedLookAndFeelException ex) { java.util.logging.Logger.getLogger(BillForm.class.getName()).log(java.util.logging.Level.SEVER E, null, ex); } //</editor-fold> /* Create and display the form */ java.awt.EventQueue.invokeLater(new Runnable() { public void run() { new BillForm().setVisible(true); } }); } // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JButton btn_backFromBill; private javax.swing.JButton btn_cancelOrder; private javax.swing.JButton btn_closeRating; private javax.swing.JButton btn_finishRate; private javax.swing.JButton btn_nextRate; private javax.swing.JButton btn_orderStatus; private javax.swing.JButton btn_rate; private javax.swing.JComboBox<String> cbx_ChooseItemToRate; private javax.swing.JScrollPane jScrollPane1; private javax.swing.JSeparator jSeparator1; private javax.swing.JLabel lbl_OrderType; private javax.swing.JLabel lbl_complain; private javax.swing.JLabel lbl_rate; private javax.swing.JPanel pnl_bill; private javax.swing.JPanel pnl_rate; private javax.swing.JTextArea txtArea_bill; private javax.swing.JTextField txt_complainMessege; private javax.swing.JTextField txt_getRate; // End of variables declaration//GEN-END:variables } 4.3 Description 1. Menu Management System Module-This module provides functionality for the power user-Administrator only. Using a graphical interface, it will allow an Admin to manage the menu that is displayed to users of the web ordering system: •Add/update/delete food category to/from the menu. •Add/update/delete food item to/from the menu. •Update price for a given food item. •Update additional information (description, photo, etc.)for a given food item. 2. Order Retrieval System Module- This is the most simplest module out of all 3 modules.It is designed to be used only by restaurant employees, and provides the following functions: •Retrieve new orders from the database •Display the orders in an easily readable, graphical way. 3. Web Ordering System Module-This module provides the functionality for customers to place their order and supply necessary details. Users of the system ,namely restaurant customers, must be provided the following functionality: •Create an account. •Manage their account. •Log in to the system. •Navigate the restaurant’s menu. •Select an item from the menu. •Add an item to their current order. •Review their current order. •Remove an item/remove all items from their current order. •Provide payment details. •Place an order. •Receive confirmation in the form of an order number. •View order placed. 4. Administrator module- This module is used to create usernames and passwords by admin. Admin can view all the information about the user or delete or edit the all details about the manager and customer. 5. Customer Module- This Functionalities provided: • View product’s list • Register • Place orders 6. Manager Module- This Functionalities provided: • Create product categories and functionalities, • Edit / delete product categories and descriptions, • View and manage orders and sales report, 7. Meal deliver module• Functionalities provided: • View pending orders and delivery details • Confirm order delivery SCHEMA • Customer 1. Customer_id (PK) 2.Customer_name 3.Customer_phonenum 4.Payment_method (Cash/Credit Card) 5.Payment_status (Paid/Unpaid) 6.Email_address 7.Employee_id (FK) 8.OrderF_id (FK) 9.OrderD_id (FK) • Employee 1.Employee_id (PK) 2.Employee_name 3.Employee_position 4.Employee_age 5.Employee_phonenum 6.password • Food 1.Food_id (PK) 2.Food_name 3.Food_size 4.Food_price (Describe price of each food) • Drinks 1.Drink_id (PK) 2.Drink_name 3.Drink_size 4.Drink_category (which explains hot/cold) 5.Drink_price (Describe price of each drink) • OrderFood 1.OrderF_id (PK) 2.Customer_id (FK) 3.Employee_id (FK) 4.Food_id (FK) 5.Quantity_item 6.Total_price • OrderDrinks 1.OrderD_id (PK) 2.Employee_id (FK) 3.Drink_id (FK) 4.Quantity_item 5.Total_Price 4.4 Code Efficiency & Error Handling Code efficiency and error handling are essential aspects of software development to ensure optimal performance and robustness. Here are some general guidelines for improving code efficiency and implementing Code effective error handling: Efficiency: 1. Optimize Algorithms and Data Structures: Choose efficient algorithms and data structures to solve problems. Analyze the time and space complexity of your code and strive for the most efficient solution. 2. Avoid Redundant Operations: Review your code for unnecessary loops, computations, or duplicate operations. Minimize the number of iterations and optimize calculations where possible. 3. Use Proper Data Types: Choose appropriate data types that match the requirements of your variables. Avoid using larger data types than necessary, as it may consume more memory and affect performance. 4. Employ Caching: Utilize caching techniques to store frequently accessed or computed data to avoid redundant computations. Caching can improve response times and reduce load on resources. 5. Minimize I/O Operations: Reduce the number of I/O operations, such as file reading or network calls, as they can be relatively slow compared to in-memory operations. Batch or buffer I/O operations whenever possible. 6. Profile and Benchmark: Regularly profile and benchmark your code to identify performance bottlenecks. Use profiling tools to measure the execution time of different code sections and identify areas for optimization. Error Handling: 1. Use Exception Handling: Implement proper exception handling to catch and handle errors gracefully. Wrap code sections that may raise exceptions in try-catch blocks and handle each exception appropriately. 2. Provide Clear Error Messages: Display meaningful and user-friendly error messages to assist in troubleshooting. Include relevant information about the error, such as error codes, descriptions, and instructions for resolution. 3. Log Errors: Use logging frameworks to record errors and exceptions. Logging helps in identifying and diagnosing issues during development and production. Log critical information, including timestamps, error stack traces, and relevant context. 4. Graceful Degradation: Implement fallback mechanisms or alternative paths in case of errors. When a critical operation fails, have a backup plan or a default behavior to avoid application crashes or unpredictable behavior. 5. Validate Inputs: Validate user inputs and external data to prevent common errors like null references, invalid format, or range violations. Perform input validation and sanitization to avoid security vulnerabilities and unexpected behavior. 6. Test Error Scenarios: Design and execute tests to cover error scenarios and edge cases. Use unit tests, integration tests, and system tests to validate error handling and ensure the application behaves as expected in exceptional conditions. 4.5 Screenshots 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. CHAPTER 5: TESTING Software testing is an investigation conducted to provide stakeholders with information about the quality of the product or service under test. Software testing can also provide an objective, independent view of the software to allow the business to appreciate and understand the risks of software implementation. Test techniques include the process of executing a program or application with the intent of finding software bugs (errors or other defects). Software testing involves the execution of a software component or system component to evaluate one or more properties of interest. In general, these properties indicate the extent to which the component or system under test: • meets the requirements that guided its design and development, • responds correctly to all kinds of inputs, • performs its functions within an acceptable time, • is sufficiently usable, • can be installed and run in its intended environments, and • achieves the general result its stakeholders desire. As the number of possible tests for even simple software components is practically infinite, all software testing uses some strategy to select tests that are feasible for the available time and resources. As a result, software testing typically (but not exclusively) attempts to execute a program or application with the intent of finding software bugs (errors or other defects). The job of testing is an iterative process as when one bug is fixed; it can illuminate other, deeper bugs, or can even create new ones. Software testing can provide objective, independent information about the quality of software and risk of its failure to users and/or sponsors. Software testing can be conducted as soon as executable software (even if partially complete) exists. The overall approach to software development often determines when and how testing is conducted. For example, in a phased process, most testing occurs after system requirements have been defined and then implemented in testable programs. In contrast, under an Agile approach, requirements, programming, and testing are often done concurrently. 5.1 Unit Testing Unit testing, also known as component testing, refers to tests that verify the functionality of a specific section of code, usually at the function level. In an object-oriented environment, this is usually at the class level, and the minimal unit tests include the constructors and destructors. These types of tests are usually written by developers as they work on code (white-box style), to ensure that the specific function is working as expected. One function might have multiple tests, to catch corner cases or other branches in the code. Unit testing alone cannot verify the functionality of a piece of software, but rather is used to ensure that the building blocks of the software work independently from each other. Unit testing is a software development process that involves synchronized application of a broad spectrum of defect prevention and detection strategies in order to reduce software development risks, time, and costs. It is performed by the software developer or engineer during the construction phase of the software development lifecycle. 5.1 Integration Testing Integration testing is any type of software testing that seeks to verify the interfaces between components against a software design. Software components may be integrated in an iterative way or all together ("big bang"). Normally the former is considered a better practice since it allows interface issues to be located more quickly and fixed. Integration testing works to expose defects in the interfaces and interaction between integrated components (modules). Progressively larger groups of tested software components corresponding to elements of the architectural design are integrated and tested until the software works as a system. It is a systematic testing. Produce tests to identify errors associated with interfacing. There are four types of integration testing as given below- • Big Bang Integration System • Top down Integration System • Bottom up Integration System • Mixed Integration System 5.3 System Testing System testing, or end-to-end testing, tests a completely integrated system to verify that the system meets its requirements. For example, a system test might involve testing a logon interface, then creating and editing an entry, plus sending or printing results, followed by summary processing or deletion (or archiving) of entries, then logoff. System testing is done after the completion of entire development process. The system as a whole is tested to uncover requirement errors. Verifies that all system elements work properly and that overall system function and that overall system system function and performance has been achieved. System testing is of 3 types- • Alpha Testing • Beta Testing • Acceptance Testing 5.4 Security Testing This section describes some typical ingredients of secure network designs. You can select from these ingredients when designing solutions for common security challenges, which are described in the "Modularizing Security Design". Techniques of security are as follows- Physical Security Physical security refers to limiting access to key network resources by keeping the resources behind a locked door and protected from natural and human-made disasters. Physical security can protect a network from inadvertent misuses of network equipment by untrained employees and contractors. It can also protect the network from hackers, competitors, and terrorists walking in off the street and changing equipment configurations. Depending on the level of protection, physical security can protect a network from terrorist and biohazard events, including bombs, radioactive spills, and so on. Physical security can also protect resources from natural disasters such as floods, fires, storms, and earthquakes. Depending on your particular network design customer, physical security should be installed to protect core routers, demarcation points, cabling, modems, servers, hosts, backup storage, and so on. Work with your customer during the early stages of the network design project to make sure equipment will be placed in computer rooms that have card key access and/or security guards. Computer rooms should also be equipped with uninterruptible power supplies, fire alarms, fireabatement mechanisms, and water-removal systems. To protect equipment from earthquakes and high winds during storms, equipment should be installed in racks that attach to the floor or wall. • Authentication Authentication identifies who is requesting network services. The term authentication usually refers to authenticating users but can also refer to authenticating devices or software processes. For example, some routing protocols support route authentication, whereby a router must pass some criteria before another router accepts its routing updates. Most security policies state that to access a network and its services, a user must enter a login ID and password that are authenticated by a security server. To maximize security, one-time (dynamic) passwords can be used. With one-time password systems, a user's password always changes. This is often accomplished with a security card, also called a Smartcard. A security card is a physical device about the size of a credit card. The user types a personal identification number (PIN) into the card. The PIN is an initial level of security that simply gives the user permission to use the card. The card provides a one-time password that is used to access the corporate network for a limited time. The password is synchronized with a central security card server that resides on the network. Security cards are commonly used by telecommuters and mobile users. They are not usually used for LAN access. Authentication is traditionally based on one of three proofs: • Something the user knows: This usually involves knowledge of a unique secret that is shared by the authenticating parties. To a user, this secret appears as a classic password, a PIN, or a private cryptographic key. • Something the user has: This usually involves physical possession of an item that is unique to the user. Examples include password token cards, security cards, and hardware keys. • Something the user is: This involves verification of a unique physical characteristic of the user, such as a fingerprint, retina pattern, voice, or face. Many systems use two-factor authentication, which requires a user to have two proofs of identity. An example is an access control system that requires a security card and a password. With twofactor authentication, a compromise of one factor does not lead to a compromise of the system. An attacker could learn a password, but the password is useless without the security card. Conversely, if the security card is stolen, it cannot be used without the password. Authorization Whereas authentication controls who can access network resources, authorization says what they can do after they have accessed the resources. Authorization grants privileges to processes and users. Authorization lets a security administrator control parts of a network (for example, directories and files on servers). Authorization varies from user to user, partly depending on a user's department or job function. For example, a policy might state that only Human Resources employees should see salary records for people they don't manage. Security experts recommend use of the principle of least privilege in the implementation of authorization. This principle is based on the idea that each user should be given only the minimal necessary rights to perform a certain task. Therefore, an authorization mechanism should give a user only the minimum access permissions that are necessary. Explicitly listing the authorized activities of each user with respect to every resource is difficult, so techniques are used to simplify the process. For example, a network manager can create user groups for users with the same privileges. Accounting (Auditing) To effectively analyze the security of a network and to respond to security incidents, procedures should be established for collecting network activity data. Collecting data is called accounting or auditing. For networks with strict security policies, audit data should include all attempts to achieve authentication and authorization by any person. It is especially important to log "anonymous" or "guest" access to public servers. The data should also log all attempts by users to change their access rights. The collected data should include user- and hostnames for login and logout attempts, and previous and new access rights for a change of access rights. Each entry in the audit log should be time stamped. The audit process should not collect passwords. Collecting passwords creates a potential for a security breach if the audit records are improperly accessed. Neither correct nor incorrect passwords should be collected. Data Encryption Encryption is a process that scrambles data to protect it from being read by anyone but the intended receiver. An encryption device encrypts data before placing it on a network. A decryption device decrypts the data before passing it to an application. A router, server, end system, or dedicated device can act as an encryption or decryption device. Data that is encrypted is called ciphered data (or simply encrypted data). Data that is not encrypted is called plain text or clear text. Encryption is a useful security feature for providing data confidentiality. It can also be used to identify the sender of data. Although authentication and authorization should also protect the confidentiality of data and identify senders, encryption is a good security feature to implement in case the other types of security fail. There are performance tradeoffs associated with encryption, however, as mentioned in the "Analyzing Security Tradeoffs" section earlier in the chapter. Encryption should be used when a customer has analyzed security risks and identified severe consequences if data is not kept confidential and the identity of senders of data is not guaranteed. On internal networks and networks that use the Internet simply for web browsing, email, and file transfer, encryption is usually not necessary. For organizations that connect private sites via the Internet, using virtual private networking (VPN), encryption is recommended to protect the confidentiality of the organization's data. Encryption has two parts: • An encryption algorithm is a set of instructions to scramble and unscramble data. • An encryption key is a code used by an algorithm to scramble and unscramble data. CHAPTER 6: MAINTAINANCE Software maintenance in software engineering is the modification of a software product after delivery to correct faults, to improve performance or other attributes.https://en.wikipedia.org/wiki/Software_maintenance A common perception of maintenance is that it merely involves fixing defects. However, one study indicated that over 80% of maintenance effort is used for non-corrective actions. This perception is perpetuated by users submitting problem reports that in reality are functionality enhancements to the system. More recent studies put the bug-fixing proportion closer to 21%. Software maintenance and evolution of systems was first addressed by Meir M. Lehman in 1969. Over a period of twenty years, his research led to the formulation of Lehman's Laws (Lehman 1997). Key findings of his research include that maintenance is really evolutionary development and that maintenance decisions are aided by understanding what happens to systems (and software) over time. Lehman demonstrated that systems continue to evolve over time. As they evolve, they grow more complex unless some action such as code refactoring is taken to reduce the complexity. In the late 1970s, a famous and widely cited survey study by Lientz and Swanson, exposed the very high fraction of life-cycle costs that were being expended on maintenance. They categorized maintenance activities into four classes: • Adaptive Maintenance • Corrective Maintenance • Perfective Maintenance • Preventive Maintenance • Periodic Maintenance • Predictive Maintenance • Adaptive Maintenance A software product might need maintenance when the customer needs the product to run on a new platform or new Operating System. • Corrective Maintenance It is necessary either to rectify the bugs observed by the user while the system is in use or redesign the entire system. • Perfective Maintenance A software product need to maintenance to support the new features that user is not aware about it to change functionality of the system according to the customer need. • Preventive Maintenance It is a daily maintenance, inspection, oiling and re-lightening), design to retain the healthy condition of equipment and prevent failure through the prevention of deterioration, periodic inspection or equipment condition diagnosis, to measure deterioration. They are of two types- ➢ Periodic Maintenance Time based maintenance consists of periodically inspecting, servicing and cleaning equipment and replacing parts to prevent sudden failure and process problems ➢ Predictive Maintenance This is a method in which the service life of important part is predicted based on inspection or diagnosis, in order to use the parts to the limit of their service life. Compared to periodic maintenance, predictive maintenance is condition based maintenance. CHAPTER 7: FUTURE SCOPE & LIMITATIONS Fast Food Management System is a web application. It is very easy to use. Customers can order food online, it saves their time as well as it saves the paper because the billing procedure is also online. The menu items are organized according to the categories so it becomes easier while placing the order. The system is implemented to reduce the manual work and enhances the accuracy of work in a restaurant. Hence the project is developed proficiently to help restaurant owners automate their business operations. This project serves the best way of maintaining customer’s information and caters their needs. CHAPTER 7: CONCLUSION Now a day’s manual process of looking for sports trainers for training of sports event of one’s choice has become the huge task.. It is very easy to get the information through this site. The main features of this site include flexibility, ease of manipulation of information, easy access searching, storage, reduction of manual work in an efficient manner, a quick, convenient, reliable, timely and effective way to reach recruiting, and search and restaurants, food availability of user’s choice. The project could very well be enhanced further as per the requirements. Goals • Reduced entry work. • Easy retrieval of information. • Reduced errors due to human intervention. • User friendly screens to enter the data. • Portable and flexible for further enhancement. • Web enabled. • Fast finding of information requested. Expected advantages of proposed software It runs on the essentials of proper management at its every stage. For everything to function in the right order a record needs to be maintained in an organized manner. As it expands, the task of data organization and maintenance becomes even more cumbersome. This is where Fast Food Management System comes to rescue. They are computer software that takes control of data corresponding to various functioning aspects. It has got following features • Ensure data accuracy • Proper control of the higher officials • Minimize manual data entry • Greater efficiency • Better service CHAPTER 9: BIBLIOGRAPHY • • h ttps://github.com/harismuneer/Restaurant-Management-System h ttps://www.softwaresuggest.com/blog/restaurant-management- s ystem-guide/ • h ttps://financesonline.com/what-is-restaurant-management- s ystem-analysis-offeatures-benefits-pricing/