In this homework, you are expected to implement a Food Delivery Application using Java. This homework will cover the topics given below:
- Generics, Interfaces
- Queue ADT, Stack ADT
- Iterators, Comparators
- Binary Search Trees
Assume that you are designing a food delivery application that runs as a marketplace for local restaurants. The restaurants and foods are placed in several binary search trees with respect to different attributes such as price, stock, restaurant rating, and delivery time.
Implement a Restaurant class that includes but is not limited to:
public class Restaurant { private String name private double rating private String cuisine private int deliveryTime // in minutes public void updateCuisine(String category) public void updateRating(double score) public void updateDeliveryTime(int deliveryTime)
// Constructors, getters, setters and other methods
}
Implement the Orderable interface that includes but is not limited to:
public interface Orderable { public void updatePrice(double price) public void updateStock(int stock)
// Other method names if needed
}
Implement a Food class that includes but is not limited to:
public class Food implements Orderable // other interfaces if needed
{ private String name private double price private int stock
private Restaurant restaurant
// Constructors, getters, setters and other methods
}
You are expected to read restaurant and food data from CENG112_HW4.txt file where each line is formed as:
fName, fPrice, fStock, rName, rRating, rCuisine, rDelivery
Note that the initial letters f and r represent food and restaurant attributes, respectively.
You should assume that restaurant names are unique and create only one instance if there are multiple restaurants with the same name in the text file. In other words, before adding a new restaurant into the BST, check if it already exists.
Perform the following operations step-by-step:
- List the names and ratings of the restaurants in descending order of rating.
- List the names, prices, and stocks of the food in ascending order of price.
- Print the name of the Pizza restaurant that has the shortest delivery time.
- Print the name of the Coffee with the highest amount of stock.
- List and remove the foods (from Food BST) that are more expensive than 80 TRY.
- List and remove the restaurants (from Restaurant BST) that are rated less than 8.0.
- Increase all food prices by 20% (use the updatePrice method).
- Cut all food stocks by half (use the updateStock method).
- List the names and ratings of the restaurants in descending order of rating. (Like Step 1).
- List the names, prices, and stocks of the food in ascending order of price. (Like Step 2).
Reviews
There are no reviews yet.