0% found this document useful (0 votes)
18 views1 page

Cafeteria Ordering System Overview

The Cafeteria Ordering System allows customers to order food via a mobile app or kiosk, featuring a menu with combo meals and individual items, customization options, upsell suggestions, and payment processing. The system includes a detailed flowchart and pseudocode outlining the order process, as well as a JavaScript implementation that manages the menu, cart, payment, and order confirmation. Users can select items, customize their orders, and receive a confirmation with an order number upon successful payment.
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)
18 views1 page

Cafeteria Ordering System Overview

The Cafeteria Ordering System allows customers to order food via a mobile app or kiosk, featuring a menu with combo meals and individual items, customization options, upsell suggestions, and payment processing. The system includes a detailed flowchart and pseudocode outlining the order process, as well as a JavaScript implementation that manages the menu, cart, payment, and order confirmation. Users can select items, customize their orders, and receive a confirmation with an order number upon successful payment.
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

Cafeteria Ordering System

Technical Documentation & Implementation


WEEK 2 FLOWGORITHM ASSIGNMENT

Scenario

A customer uses a mobile app or kiosk to order food from a cafeteria. The system displays
the menu with combo meals and individual items, allows customizations, suggests upsells
(like drinks or desserts), processes payment, and generates an order confirmation with an
order number for pickup.

Process Flowchart

START

View Menu

Select Order Type

Individual Items

Choose Individual Item Combo Mea

Yes

Add More Items? Choose Combo Mea

No

Want Customization?

Yes

Apply Customization No

No

View Car

Show Upsell Suggestion

Accept

Add to Car Decline

Calculate Tota

Review Order

Confirm Order?

Yes

Select Payment Metho

Process Paymen

Payment Success?

No Yes

Payment Failed Generate Order Numbe

Send Confirmatio

Display Order Detail

END

Algorithm Pseudocode

Cafeteria_Ordering_System.algo

PROGRAM Cafeteria_Ordering_System

// 1. Initialization
DECLARE cart AS LIST
DECLARE totalAmount AS REAL
DECLARE orderType AS STRING
DECLARE customizations AS LIST
DECLARE paymentStatus AS BOOLEAN
DECLARE orderNumber AS STRING

FUNCTION main()
Display("Welcome to Cafeteria Ordering System")

// 2. Display Menu
DisplayMenu()

// 3. Select Order Type


Display("Select: 1) Combo Meal 2) Individual Items")
orderType = GetUserChoice()

IF orderType == "combo" THEN


selectedCombo = SelectComboMeal()
AddToCart(selectedCombo)
ELSE
REPEAT
item = SelectIndividualItem()
AddToCart(item)
Display("Add more items? (Yes/No)")
UNTIL GetUserChoice() == "No"
ENDIF

// 4. Customization
Display("Want to customize your order? (Yes/No)")
IF GetUserChoice() == "Yes" THEN
customizations = ApplyCustomizations()
ENDIF

// 5. View Cart
DisplayCart(cart)

// 6. Upselling
upsellItems = SuggestUpsell()
Display("Would you like to add: " + upsellItems)
IF GetUserChoice() == "Yes" THEN
AddToCart(upsellItems)
ENDIF

// 7. Calculate Total
totalAmount = CalculateTotal(cart)
Display("Total Amount: ₹" + totalAmount)

// 8. Review and Confirm


Display("Review your order. Confirm? (Yes/No)")
IF GetUserChoice() == "No" THEN
Display("Order cancelled. Returning to menu.")
main() // Restart
ENDIF

// 9. Payment Processing
REPEAT
paymentMethod = SelectPaymentMethod()
paymentStatus = ProcessPayment(paymentMethod, totalAmount)

IF paymentStatus == FALSE THEN


Display("Payment Failed. Please try again.")
ENDIF
UNTIL paymentStatus == TRUE

// 10. Generate Order


orderNumber = GenerateOrderNumber()
SendConfirmation(orderNumber)

// 11. Display Order Details


Display("Order Successful!")
Display("Order Number: " + orderNumber)
Display("Please collect your order at the counter.")

Display("Thank you for ordering!")


END FUNCTION

// Helper Functions

FUNCTION DisplayMenu()
Display("--- MENU ---")
Display("Combo Meals:")
Display("1. Burger Combo - ₹150")
Display("2. Pizza Combo - ₹200")
Display("3. Sandwich Combo - ₹120")
Display("Individual Items:")
Display("4. French Fries - ₹50")
Display("5. Cold Drink - ₹30")
Display("6. Ice Cream - ₹40")
END FUNCTION

FUNCTION CalculateTotal(cart)
total = 0
FOR EACH item IN cart
total = total + [Link]
END FOR
RETURN total
END FUNCTION

FUNCTION GenerateOrderNumber()
orderNum = "ORD" + GetCurrentTimestamp()
RETURN orderNum
END FUNCTION

END PROGRAM

JavaScript Implementation

[Link]

// Cafeteria Ordering System - JavaScript Implementation

class CafeteriaOrderingSystem {
constructor() {
[Link] = [];
[Link] = {
combos: [
{ id: 1, name: "Burger Combo", price: 150 },
{ id: 2, name: "Pizza Combo", price: 200 },
{ id: 3, name: "Sandwich Combo", price: 120 }
],
items: [
{ id: 4, name: "French Fries", price: 50 },
{ id: 5, name: "Cold Drink", price: 30 },
{ id: 6, name: "Ice Cream", price: 40 }
]
};
[Link] = [
{ name: "Extra Cheese", price: 20 },
{ name: "Dessert", price: 40 }
];
}

// Display Menu
displayMenu() {
[Link]("=== CAFETERIA MENU ===");
[Link]("\nCombo Meals:");
[Link](item => {
[Link](`${[Link]}. ${[Link]} - ₹${[Link]}`);
});
[Link]("\nIndividual Items:");
[Link](item => {
[Link](`${[Link]}. ${[Link]} - ₹${[Link]}`);
});
}

// Add item to cart


addToCart(item) {
[Link](item);
[Link](`Added to cart: ${[Link]}`);
}

// Display Cart
displayCart() {
[Link]("\n=== YOUR CART ===");
if ([Link] === 0) {
[Link]("Cart is empty");
return;
}
[Link]((item, index) => {
[Link](`${index + 1}. ${[Link]} - ₹${[Link]}`);
});
}

// Calculate Total
calculateTotal() {
return [Link]((sum, item) => sum + [Link], 0);
}

// Suggest Upsell
suggestUpsell() {
[Link]("\n=== RECOMMENDED FOR YOU ===");
[Link]((item, index) => {
[Link](`${index + 1}. ${[Link]} - ₹${[Link]}`);
});
return [Link][0]; // Return first suggestion
}

// Process Payment
processPayment(method, amount) {
[Link](`\nProcessing payment of ₹${amount} via ${method}...`);
// Simulate payment processing
const success = [Link]() > 0.1; // 90% success rate

if (success) {
[Link]("Payment Successful!");
} else {
[Link]("Payment Failed. Please try again.");
}

return success;
}

// Generate Order Number


generateOrderNumber() {
return `ORD${[Link]()}`;
}

// Main Order Process


placeOrder(orderType, itemIds, acceptUpsell = false) {
[Link]("=== CAFETERIA ORDERING SYSTEM ===");

// Step 1: Display Menu


[Link]();

// Step 2: Add items based on type


if (orderType === 'combo') {
const combo = [Link](c => [Link] === itemIds[0]);
if (combo) [Link](combo);
} else {
[Link](id => {
const item = [Link](i => [Link] === id);
if (item) [Link](item);
});
}

// Step 3: Display Cart


[Link]();

// Step 4: Upselling
const upsellItem = [Link]();
if (acceptUpsell) {
[Link](upsellItem);
}

// Step 5: Calculate Total


const total = [Link]();
[Link](`\nTotal Amount: ₹${total}`);

// Step 6: Process Payment


let paymentSuccess = false;
let attempts = 0;

while (!paymentSuccess && attempts < 3) {


paymentSuccess = [Link]("UPI", total);
attempts++;
}

if (!paymentSuccess) {
[Link]("Order cancelled due to payment failure.");
return null;
}

// Step 7: Generate Order


const orderNumber = [Link]();

// Step 8: Display Confirmation


[Link]("\n=== ORDER CONFIRMED ===");
[Link](`Order Number: ${orderNumber}`);
[Link](`Total Paid: ₹${total}`);
[Link]("Please collect your order at the counter.");
[Link]("Thank you for ordering!");

return {
orderNumber: orderNumber,
items: [Link],
total: total,
status: "confirmed"
};
}
}

// Example Usage
[Link]("\n--- Example 1: Combo Meal Order ---");
const system1 = new CafeteriaOrderingSystem();
[Link]('combo', [1], true); // Burger Combo with upsell

[Link]("\n\n--- Example 2: Individual Items Order ---");


const system2 = new CafeteriaOrderingSystem();
[Link]('individual', [4, 5], false); // Fries + Drink, no upsell

You might also like