Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Think about one task you perform so often, it is nearly automatic. Break that task down into its component parts and write a program that

Think about one task you perform so often, it is nearly automatic. Break that task down into its component parts and write a "program" that resembles the grocery self-checkout code provided to describe your task. Your task should include:

  • At least three major steps, listed in chronological order
  • Specific instructions that describe each step
  • Conditions that direct the flow of the program, such as "if-then," "while," or "until."
  • Comments that explain your program
  • Line numbers

I need pseudo code which resemblance with grocery code some other automatic task not same grocery task. Thanks in advance.

1 /** 2 * How to use a self-checkout lane at a grocery store 3 * By Your Name, 06/06/2011 4 * 5 * Assumes you have a shopping cart full of groceries 6 * and no help scanning or bagging unless you specifically 7 * summon an employee for assistance. 8 */ 9 10 StepOne SelectItem //Grab an item from cart or basket 11 { 12 Question: Are there any items left to be scanned? 13 /* Checks to see if you're all done scanning 14 If the answer is no, move to StepFive 15 16 Pick up item to be scanned 17 } 18 19 StepTwo ScanBarCode //Ring up the item from StepOne 20 { 21 Until you can locate the bar code, 22 Keep rotating the item along the x-, y-, and z-axes 23 /* Spin it every which way. Where is that UPC code? 24 25 Question: Did you find the bar code yet? 26 If no, answer this question: Have 15 seconds elapsed? 27 28 If no, then keep looking for the bar code 29 Otherwise, start SkuLookup //Treat it like produce 30 { 31 Place item on the scale 32 Find item in the SKU lookup book at register 33 Question: Is the SKU number in the book? 34 35 If yes, then InputSkuNumber 36 { 37 Input the SKU number 38 Wait for the item to be priced 39 Remove the item from the scale 40 Go to StepThree 41 } 42 Otherwise, press 'Call attendant' help button 43 /** 44 * Assumes items with no bar code can be identified 45 * in a lookup database present at machine. 46 */ 47 } 48 49 Until you hear a confirmation tone, 50 Hold the bar code over the scanner, 51 Rotating the item slightly 52 } 53 54 StepThree ConveyToBagging //Assumes there is a conveyer belt 55 { 56 Place item on conveyor belt 57 Wait until item travels down entire conveyor belt 58 /* Computer compares item on belt to expected height/weight 59 60 Question: Is the computer asking you to rescan item? 61 If yes, then return to StepTwo 62 Otherwise, continue 63 64 Question: Is the bagging area full? 65 If yes, then go to StepFour 66 Otherwise, go to StepOne 67 } 68 69 StepFour BagGroceries // No room to scan new items 70 { 71 Question: Did you bring your own shopping bags? 72 If yes, then use the bags you brought. 73 Otherwise, answer this question: 74 75 Do you have to buy empty bags at this store? 76 If yes, then purchase bags for scanned items 77 Otherwise, place items into bags provided 78 79 Group refrigerated and frozen items together when possible 80 Place heavier items below lighter items 81 82 Question: Have you completed StepFive? 83 If yes, then the checkout process is complete 84 Otherwise, go to StepOne 85 86 /** 87 * This step assumes the user has some prior experience 88 * bagging groceries. More detail could be added. 89 */ 90 } 91 92 StepFive SubmitPayment // No items left to scan 93 { 94 Press the 'Finished scanning items' button 95 96 Question: Are you paying with cash? 97 If yes, then begin PayingWithCash 98 { 99 Insert appropriate number of bills 100 Insert coins, if desired 101 Press 'Finished inserting cash' 102 Check coin/bill return area for change 103 } 104 Question: Are you paying with a debit or credit card? 105 If yes, then begin PayingWithCredit 106 { 107 Swipe card through card reader 108 If a debit card, enter your PIN when prompted 109 If prompted for a signature, use stylus to sign 110 } 111 /* Assumes not paying by check. Who does that anymore? 112 113 Collect receipts and all paperwork 114 Question: Are any groceries left unbagged? 115 If yes, go to StepFour 116 }

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

MongoDB Applied Design Patterns Practical Use Cases With The Leading NoSQL Database

Authors: Rick Copeland

1st Edition

1449340040, 978-1449340049

More Books

Students also viewed these Databases questions

Question

What is value-based management?

Answered: 1 week ago

Question

What does Processing of an OLAP Cube accomplish?

Answered: 1 week ago