Git Product home page Git Product logo

aaisha-nexus / restaurantmenumanagement Goto Github PK

View Code? Open in Web Editor NEW
2.0 1.0 0.0 4 KB

This program focuses on encapsulation, Arraylist, Getters and setters, constructor chaining, toString method and provides functionality by various options to user to add, remove, update, search ,display and filter dishes in a Menu.

Java 100.00%
access-modifiers arraylist-java classes-and-objects constructor-chaining constructors coreprogram encapsulation getters-and-setters java javaapplication

restaurantmenumanagement's Introduction

Restaurant Menu Management

This is a simple Java-based program that manages a collection of dishes in a restaurant. The program allows users to add, remove, display, search, and update dish details like price and rating.

Features

  • Add a Dish: Add a new dish to the collection with a name, price, and rating.
  • Remove a Dish: Remove a dish from the collection by its name.
  • Display All Dishes: Show all dishes in the collection with their details.
  • Display Dishes by Price: Filter and display dishes based on a specified price.
  • Display Dishes by Ratings: Filter and display dishes based on a specified rating.
  • Search Dish by Name: Search for a dish by its name and display its details.
  • Update Dish Details: Update the price and rating of an existing dish.

Classes and Methods

Dish

Instance Variables:

  • String dishName: Name of the dish.
  • double price: Price of the dish.
  • int rating: Rating of the dish (out of 5).

Constructors:

  • Dish(String dishName, double price): Creates a dish with a specified name and price, with a default rating of 3.
  • Dish(String dishName, double price, int rating): Creates a dish with the specified name, price, and rating.

Methods:

  • String getDishName(): Returns the name of the dish.
  • double getPrice(): Returns the price of the dish.
  • int getRating(): Returns the rating of the dish.
  • void setDishName(String dishName): Updates the name of the dish.
  • void setPrice(double price): Updates the price of the dish.
  • void setRating(int rating): Updates the rating of the dish.
  • String toString(): Returns a string representation of the dish, including its name, price, and rating.

DishCollection

Instance Variables:

  • ArrayList<Dish> dishes: A collection that holds multiple Dish objects.

Constructors:

  • DishCollection(): Initializes an empty collection of dishes.

Methods:

  • void addDish(Dish dish): Adds a new dish to the collection.
  • void removeDish(String dishName): Removes a dish from the collection based on its name.
  • void displayDish(): Displays all dishes currently in the collection.
  • void displayDishByPrice(double price): Displays all dishes that match the specified price.
  • void displayDishByRatings(int rating): Displays all dishes that match the specified rating.
  • void searchDishByName(String dishName): Searches for a dish by its name and displays its details.
  • void updateDish(String dishName, double newPrice, int newRating): Updates the price and rating of an existing dish based on its name.

Contribution

Contributions are welcome! If you have any suggestions or find any issues, feel free to submit a pull request or open an issue.

restaurantmenumanagement's People

Contributors

aaisha-nexus avatar

Stargazers

 avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.