![]() |
|
[Java] Restaurant Management System - Printable Version +- Hack Forums (https://hackforums.net) +-- Forum: Tech (https://hackforums.net/forumdisplay.php?fid=444) +--- Forum: Coding (https://hackforums.net/forumdisplay.php?fid=151) +---- Forum: Software Development (https://hackforums.net/forumdisplay.php?fid=118) +---- Thread: [Java] Restaurant Management System (/showthread.php?tid=5966686) |
Restaurant Management System - trollgirll - May 4, 2019 Hey guys ! I'm making a restaurant management system. The system contains the: Restaurant class Table class Customer class Menu class Item Class Order Class Bill Class My Restaurant Class contains Array List of Customers and an Array List of Tables My main problem is that how can i make the customer: reserve a table giving the table number at a certain time. cancel table reservation. Find available tables. When all tables are occupied no other customers are allowed to reserve anymore and how could i use them in the main ? This is the Customer Class: public class Customer { private String fname; private String lname; private String pbn; private int ID ; static int n; Customer order; public Customer() { ID=0; this.fname = ""; this.lname = ""; this.pbn = ""; } public Customer(String fname, String lname, String pbn) { n++; this.ID=n; this.fname = fname; this.lname = lname; this.pbn = pbn; } public String getFname() { return fname; } public void setFname(String fname) { this.fname = fname; } public void setCustomerId(int ID) { n++; this.ID = n; } public static void setN(int n) { Customer.n = n; } public String getLname() { return lname; } public String getCustomerName(){ Customer c1= new Customer(); String cn=c1.getFname()+c1.getLname(); return cn; } public void setLname(String lname) { this.lname = lname; } public String getPbn() { return pbn; } public void setPbn(String pbn) { this.pbn = pbn; } @Override public String toString() { return "Customer{" + "fname=" + fname + ", lname=" + lname + ", pbn=" + pbn + ", ID=" + ID + '}'; } public Customer getOrder() { return order; } public void setOrder(Customer mOrder) { this.order = mOrder; } } Table Class: private boolean mOccupied; public Table(){ mOccupied = false; } public boolean isOccupied(){ return mOccupied == true; } public void bookTable(){ mOccupied = true; } public void releaseTable(){ mOccupied = false; } } Restaurant Class: List<Table> tables; private Date date; int reservationNumber; static int n ; List<Customer> mcustomers; public Restaurant() { n++; this.reservationNumber = n; } public List<Table> tables() { return tables; } public void setTables(List<Table> tables) { this.tables = tables; } public void addTables(List<Table> tables) { this.tables.addAll(tables); } public Date date() { return date; } public void setDate(Date date) { this.date = date; } public int reservationNumber() { return reservationNumber; } @Override public String toString() { return "Reservation [reservationNumber=" + reservationNumber + ", tables=" + tables + ", date=" + date + "]"; } Could anyone help please !! RE: Restaurant Management System - martianhax - May 5, 2019 hopefuly you van find your answer, and welcome to hf! RE: Restaurant Management System - GenericSkid - May 5, 2019 It would help to format your code using [php] tags like so: PHP Code RE: Restaurant Management System - .C1PH3R. - May 5, 2019 First of all I even didn't look at your code. Use the tags. My main problem is that how can i make the customer: You need it in a GUI ? you can make a first name ,last name and more personal information. You can hard code this but also with user input. reserve a table giving the table number at a certain time. Why should you give a table number at a certain time ? In restaurants table numbers are always the same. You can code this in the constructor and use ++ to high up the table numbers every time a table is created. cancel table reservation. Make a function that replaces the reservation with empty strings for example when the functie is called. Find available tables. Well if you have the reservation you can search in the reservation if you know all your table numbers. Store it in a array or something. When all tables are occupied no other customers are allowed to reserve anymore make a if else statement in your table class RE: Restaurant Management System - newQuery - May 6, 2019 (May 5, 2019 10:37 AM).C1PH3R. Wrote: First of all I even didn't look at your code. Use the Also, write your tests before writing your code ;) |