Question
//Declare local variables/attributes const HAMBURGER_COMBO_DESC = Hamburger Combo; const CHEESEBURGER_COMBO_DESC = Cheeseburger Combo; const VEGGIEBURGER_COMBO_DESC = Veggieburger Combo; const CHICKEN_STRIP_PLATTER_DESC = Chicken Strip Platter; const
//Declare local variables/attributes const HAMBURGER_COMBO_DESC = "Hamburger Combo"; const CHEESEBURGER_COMBO_DESC = "Cheeseburger Combo"; const VEGGIEBURGER_COMBO_DESC = "Veggieburger Combo"; const CHICKEN_STRIP_PLATTER_DESC = "Chicken Strip Platter"; const COOKIES_DESC = "Cookies"; const HAMBURGER_COMBO_COST = 10.00; const CHEESEBURGER_COMBO_COST = 12.00; const VEGGIEBURGER_COMBO_COST = 16.00; const CHICKEN_STRIP_PLATTER_COST = 14.00; const COOKIES_COST = 1.00; let orderCost = 0; let numItems = 0; let customerName = ""; //main function function fastFood(){ const EXIT = "X"; const MENU = "------------------------- " + "- CIS Fast-Food App " + "- A - Add an item to an order " + "- B - View Order details " + "- X-eXit " + "------------------------- " + "Option-->"; //Add a loop below to continuously prompt the user for their choice //until they choose to exit. let option = ""; //Capture customer name //Present menu do { option = prompt(MENU); processMenuOption(option); } while (option.toUpperCase() !== EXIT); } /** * This method will process the menu option specified in the input * parameter. It will call appropriate functionality based on its value. function processMenuOption(option) { //Add a switch to process the option } function addItem() { const ORDER_MENU = "------------------------ " + "- Please choose " + "- 1- Hamburger Combo - $10.00 " + "- 2 - Cheeseburger Combo - $12.00 " + "- 3 - ChickenStrip Meal - $14.00 " + "- 4 - Veggieburger Combo - $16.00 " + "- 5 - Cookies - $1.00 " + "------------------------- " + "Option-->"; let orderOption; orderOption = prompt(ORDER_MENU); //return order option } function processItem(orderOption){ let itemDesc = ""; //Process item //Keep counter of order items // display output in an alert } function displayOrder() { return ""; } //Run the Fast-Food App fastFood();
placeOrder.js is attached to newly created html file.
fastfood () function- when called user is presented with app menu and keep prompting until they enter a valid choice. once a valid choice has been entered the value is passed to the processMenuOption funtion for processing. Customer name is captured for future output.
processMenuOption () funtction acceptes value passed from fastfood(). Based on users choice call other funtions that add/process items and display output
processitem() funtion should present the user with an item menu that prompts user for their food choice. Choose a number between 1 and 5. This function should return an integer, orderitem, between 1 and 5. pass the returned value as parameter to processitem().
processitem() function- Accepts an item choice (integer) as a parameter. Based on the item choice the cost is added to the overall order total, the number of order items is updated and an alert to the user detailing an item description and cost as currency is generated.
displatOutput() function- return a formatted string for output as seen in the stated requirements. end the program
Header comments functionally clean code.
JAVA SCRIPT
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started