0% found this document useful (0 votes)
3 views

fswd university lab writing part

Uploaded by

Reena V 12 A
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views

fswd university lab writing part

Uploaded by

Reena V 12 A
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

Aim:

Develop a user-friendly food delivery website that allows users to browse a


restaurant's menu, select items, place orders, and track delivery in real time. The
system includes secure payment integration and ensures seamless order
management.

Software Required:
• Frontend: Flutter (Dart)
• Backend: Firebase, Node.js, Django (choose one)
• Database: Firebase Firestore or SQLite
• Development Platform: Windows
• Tools: Visual Studio Code, Android Studio/Flutter SDK, Firebase
Console

Algorithm (6 Simple Steps):

1. Initialize the Project: Set up the Flutter app, connect it with Firebase,
and configure backend services.
2. Design User Interface: Create screens for viewing the menu, cart
management, checkout, and order tracking.
3. Fetch and Display Menu: Retrieve the restaurant's menu from Firebase
Firestore or the database and show it on the UI.
4. Handle Cart Operations: Allow users to add, remove, and update items
in their cart.
5. Process Order and Payment: Save the order details in the database and
integrate a secure payment gateway for transactions.
6. Enable Order Tracking: Update and display real-time order status using
Firebase or backend services.
Pseudocode for Frontend (Flutter - Dart)
# Initialize Firebase and Flutter
initializeFirebase();
initializeFlutterApp();

# Display the Menu


menuItems = fetchMenuFromBackend();
displayMenu(menuItems);

# Handle Add to Cart


cart = [];
function onAddToCart(item):
cart.add(item);

# Checkout Process
function onCheckout():
orderId = sendOrderToBackend(cart);
navigateToPaymentPage(orderId);

# Display Order Tracking


function showOrderTracking(orderId):
orderStatus = fetchOrderStatusFromBackend(orderId);
displayOrderStatus(orderStatus);

# Run the App


main():
initializeUI();
loadMenuItems();

Pseudocode for Backend (Node.js/Django/Firebase)


# Set up Backend Server
initializeServer();
connectToDatabase();

# Fetch Menu from Database


function fetchMenu():
menu = database.query("SELECT * FROM menu_items");
return menu;

# Handle Order Placement


function placeOrder(orderDetails):
orderId = database.insert("orders", orderDetails);
return orderId;

# Process Payment
function processPayment(orderId, paymentDetails):
paymentStatus = paymentGateway.process(paymentDetails);
if paymentStatus == "Success":
database.update("orders", {"status": "Placed"}, where={"id": orderId});
return paymentStatus;

# Update and Fetch Order Tracking


function updateOrderStatus(orderId, status):
database.update("orders", {"status": status}, where={"id": orderId});
function fetchOrderStatus(orderId):
return database.query("SELECT status FROM orders WHERE id = ?",
[orderId]);

# Run Backend
startServer();

Pseudocode for Database (Firebase Firestore/SQLite)


# Firebase Firestore Database Schema
MenuItems Collection:
- id: String
- name: String
- price: Float
- description: String
- imageUrl: String

Orders Collection:
- id: String
- userId: String
- items: Array
- totalAmount: Float
- status: String (e.g., "Placed", "In Transit", "Delivered")
- paymentStatus: String (e.g., "Pending", "Success", "Failed")

# Example Queries

# Fetch All Menu Items


function fetchMenuItems():
return Firestore.collection("MenuItems").get();

# Insert a New Order


function insertOrder(orderDetails):
return Firestore.collection("Orders").add(orderDetails);

# Update Order Status


function updateOrderStatus(orderId, status):
Firestore.collection("Orders").document(orderId).update({"status": status});

# Fetch Order Status


function fetchOrderStatus(orderId):
return Firestore.collection("Orders").document(orderId).get("status");

OUTPUT:
RESULT:
The food delivery website was successfully executed on the Windows platform.

You might also like