Skip to content

Frederic-Chopin/Evive

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Evive Meal Ordering System

  • Update1: I've made some changes to the project, so download the project zip file at https://github.com/Frederic-Chopin/Evive for the latest version!
  • Update2: All provided tests are passes when input is provided via args. One tiny issue exists when input is provided via Stin, when there's no dish index. More detailed explanation is provided in the Input section of Readme.

About The Project

This system takes in meal order for breakfast, lunch, or dinner, and takes in the order number 1 to 3 for breakfast and lunch, 1 to 4 for dinner. It returns the dishes ordered.

Design Idea

This project uses Java Object-Oriented Programming design principle, and exploits the inheritance hierarchical structure. The meal class is the super class, which has common attributes and methods for all 3 meals. Breakfast, Lunch, and Dinner are children class, which inherits Meal but have some unique attributes. They override some methods in Meal.

Results

  • All functions in the design doc are implemented
  • All rules are followed
  • A total of 31 Junit tests are provided, covering every requirement in the design doc and some additional once.
  • Some additional features are added. For instance, the program can run repeatedly by selecting "y"

Getting Started

Prerequisites: Java

Make sure java is installed. If not, please download the latest version of Java here:

  • Download Java
    https://www.oracle.com/java/technologies/downloads/
  • Install Java based on instructions here
    https://www.java.com/en/download/help/download_options.html

Getting the code

After Java is installed, get the code from https://github.com/Frederic-Chopin/Evive

  1. Open a local terminal and clone the repo
    git clone https://github.com/Frederic-Chopin/Evive.git
  2. Go to src folder
    cd src
  3. Compile the Java program
    javac Main.java
  4. Execute the program
    java Main 
    #Provide input in the next line
    or
    java Main breakfast 1 2 3

Input

  • Inputs can be provided along with java Main, or can be provided in the next line. Follow the steps below to provide the input:

    1. Input a meal type, Breakfast, Lunch, or Dinner (case-insensitive).
    2. Enter integer from 1 to 3 for Breakfast and Lunch, 1 to 4 for Dinner, separated by comma.
    • e.g. Breakfast 1, 2, 3
    • Lunch 3, 2, 1, 2
    • Dinner 1, 3, 4, 4, 2
    1. The program will output the ordering
    2. A prompt will appear, enter y to continue, n to quit
  • Note:

    • When input is provided via stin, the program will keep running until a dish index is provided, because stin will be waiting for an input
    • /So if only breakfast/lunch/dinner is provided, it will not finish
    • This is a bug and I'll try to fix
    • This problem does not exist when input is provided via args.

Code Details

Components

  • meal
    • src
      • main/java
        • Meal.java: The superclass, provides common functions and features
        • Breakfast.java: child class, implements Meal in more detail
        • Lunch.java: child class, implements Meal in more detail
        • Dinner.java: child class, implements Meal in more detail
        • Main.java: driver function, parses in and processes input, creates Meal object
      • test
        • regular.java: 10 Junit tests, targeting all functioning requirements
        • exceptions.java: 21 Junit tests, targeting all exceptional cases

Rules

  • An order consists of a meal and collection of comma separated item Ids
  • The system should return the name of the items ordered
  • The system should always return items in the following order: meal, side, drink
  • If multiple items are ordered, the number of items should be indicated
  • Each meal must contain a main and a side
  • If no drink is ordered, water is returned as a default
  • At breakfast, multiple cups of coffee can be ordered
  • At lunch, multiple sides can be ordered
  • At dinner, dessert must be ordered
  • At dinner, water is always provided

Sample inputs and outputs

  • breakfast 3 --> Unable to process: Main is missing, side is missing
  • breakfast 2, 3 --> Unable to process: Main is missing
  • breakfast 1, 3 --> Unable to process: Side is missing
  • breakfast 1, 2, 3 --> Eggs, Toast, Coffee
  • Breakfast 3, 3, 1, 2 --> Eggs, Toast, Coffee(2)
  • LUNCH 2, 3, 2, 2 --> Sandwich, Chips(3), Soda
  • dinner 1, 3, 2, 1 --> Unable to process: Dessert is missing
  • dinner 4, 4, 3, 2, 1 --> Steak, Potatoes, Wine, Water, Cake(2)
  • Dinner 1, 1, 2, 3, 4 --> Steak cannot be ordered more than once
  • dinner 1, 2, 3, 4, 5 --> Please enter number in the range 1 ~ 4

Acknowledgments

This project is intended for and only for a take home assignment for Evive. Visit their website www.goevive.com for more information.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages