Grocery Store Inventory System: Assignment

Added on - 16 Sep 2019

  • 43

    pages

  • 13942

    words

  • 84

    views

  • 0

    downloads

Showing pages 1 to 8 of 43 pages
1Fall 2016.Grocery Store Inventory SystemFile IO and Final assemblyIPC44 Project (Milestone 5, Due Fri Dec 9th23:59, seeproject webpage)(V1.1, corrected the datefile definitions and added comments.txt to OPEN submission)In a grocery store, in order to be able to always have the proper number of items available onshelves, an inventory system is needed to keep track of items available in the inventory andmake sure the quantity of the items does not fall below a specific count.Your job for this project is to prepare an application that manages the inventory of itemsneeded for a grocery store. The application should be able to keep track of the followinginformation about an item:1-The SKU number2-The name (maximum of 20 chars)3-Quantity (On hand quantity currently available in the inventory)4-Minimum Quantity (if the quantity of the item falls less than or equal to this value, awarning should be generated)5-Price of the item6-Is the item TaxedThis application must be able to do the following tasks:1-Print a detailed list of all the items in the inventory2-Search and display an item by its SKU number3-Checkout an item to be delivered to the shelf for sale4-Add to stock items that are recently purchased for inventory (add to their quantity)5-Add a new item to the inventory or update an already existing item6-Delete an item from the inventory (optional for extra marks)7-Search for an item by its name (optional for extra marks)8-Sort Items by Name (optional for extra marks)PROJECT DEVELOPMENT PROCESSTo make the development of this application fun and easy, the tasks are broken down intoseveral functions that are given to you from very easy ones to more complicated one by theend of the projectSince you act like a programmer in this project, you do not need to know the big picture. Theprofessor is your system analyst and designs the system and all its functions to work together inharmony. Each milestone is divided into a few functions. For each function, firstly, understandthe goal of the function. Secondly, write the code for it and test it with the tester. Once your
2code for the function passes the test, set it aside and pick up the next function. Continue untilthe milestone is complete.The Development process of the project is divided into six milestones and therefore sixdeliverables. The first five deliverables are mandatory and conclude full submission of theproject. The sixth milestone is optional; for those who want to do some extra work for thechallenge and the bonus marks. For each deliverable, a tester program (also called a unit test)will be provided to you to test your functions. If the tester works the way it is supposed to do,you can submit that milestone and start the next. The approximate schedule for deliverables isas followsKickoffweek 7The UI ToolsDue in 10 daysThe Application User InterfaceDue 5 days after UIThe Item IODue 7 days after Application User InterfaceItem Storage and Retrieval in ArrayDue 10 days after Item IOFile IOand final assemblyDue 5 days after Item Storage (project completed)Item Search by name, delete and sort (optional) 7 days after Project completionFILE STRUCTURE OF THE PROJECTFor each milestone, a source file is provided under the name ipc_msX.c that includes the main()tester program. (Replace X with the milestone number from 1 to 6)The main program acts like a tester (a unit test). Code your functions in this file and test themone by one using the main function provided. You can comment out the parts of the mainprogram for which functions are not developed yet. You are not allowed to change the code intester. Make sure you do not make any modifications in the tester.MARKING:Please follow this link for marking details:https://scs.senecac.on.ca/~ipc144/dynamic/assignments/Marking_Rubric.pdfMILESTONE 1: THE USER INTERFACE TOOLS (DUE SAT OCT 29TH)Download or Clone milestone 1 fromhttps://github.com/Seneca-144100/IPC_MS1Inipc_ms1.cwrite the following functions:voidwelcome(void);Prints the following line and goes to newline>---=== Grocery Inventory System ===---<voidprnTitle(void);
3Prints the following two lines and goes to newline>Row |SKU| Name | Price |Taxed| Qty | Min | Total |Atn<>----+---+--------------------+--------+-----+-----+-----+------------|---<voidprnFooter(doublegTotal);Prints the following line and goes to newline>--------------------------------------------------------+----------------<Then if gTotal is greater than zero it will print this line: (assuming gTotal is 1234.57) andgo to new line.>Grand Total: | 1234.57<Use this format specifier for printing gTotal :%12.2lfvoidclrKyb(void);“clear Keyboard” Makes sure the keyboard is clear by reading from keyboard characterby character until it reads a new line character.Hint: In a loop, keep reading single characters from keyboard until newline character isread ('\n'). Then, exit the loop.voidpause(void);Pauses the execution of the application by printing a message and waiting for user to hit<ENTER>.Print the following line and DO NOT go to newline:>Press <ENTER> to continue...<Then, callclrKybfunction.Here the clrKyb function is used for a fool-proof <ENTER> key entry.intgetInt(void);Gets a valid integer from the keyboard and returns it. If the integer is not valid it willprint:"Invalid integer, please try again: "and try again.This function must be fool-proof; it should not let the user pass, unless a valid integer isentered.Hint: to do this, you can have two variables read back to back by scanf; an integer and then a character ("%d%c") and make sure the second (the character) is new line. If the second character is new line, then thisguaranties that first integer is successfully read and also after the integer <ENTER> is hit. If the character isanything but new line, then either the user did not enter an integer properly, or has some additionalcharacters after the integer, which is not good. In this case clear the keyboard, print an error message andscan the integer again. See the flowchart below.
4Loop whileNL!=\nScanValueandNLNL!=\nStartgetInt()Set characterNLtoxcreate integerValuePrint errormessageReturnValueTrueTrueFalseFalseCall clrKyb()intgetIntLimited(intlowerLimit,intupperLimit);This function uses getInt() to receive a valid integer and returns it. This function makessure the integer entered is within the limits required (betweenlowerLimitandupperLimitinclusive). If the integer is not within the limits, it will print:>"Invalid value,TheLowerLimmit< value <TheUpperLimit: "<and try again.(Change the lower and upper limit with their values.)This function is fool-proof too; the function will not let the user pass until a valid integeris received within the lower and upper limit values. See below:
5If Value is not withinupperandlowerlimitsStartgetIntLimited(upperLimit,lowerLimit)Create integerValuePrint ErrorReturnValueTrueTrueFalseFalseValue=getInt()Loop whileValueis not withinupperandlower limitsdoublegetDbl(void);Works exactly likegetInt()but scans a double instead of an integer with the followingerror message:"Invalid number, please try again: "doublegetDblLimited(doublelowerLimit,doubleupperLimit);Works exactly likegetIntLimited()but scans a double instead of an integer.
6OUTPUT SAMPLE:(UNDERLINED,ITALICBOLDREDVALUES ARE USER ENTRIES)---=== Grocery Inventory System ===---listing header and footer with grand total:Row |SKU| Name | Price |Taxed| Qty | Min | Total |Atn----+---+--------------------+--------+-----+-----+-----+------------|-----------------------------------------------------------+----------------Grand Total: | 1234.57listing header and footer without grand total:Row |SKU| Name | Price |Taxed| Qty | Min | Total |Atn----+---+--------------------+--------+-----+-----+-----+------------|-----------------------------------------------------------+----------------Press <ENTER> to continue...<ENTER>Enter an integer:abcInvalid integer, please try again:10abcInvalid integer, please try again:10You entered: 10Enter an integer between 10 and 20:9Invalid value, 10 < value < 20:21Invalid value, 10 < value < 20:15Your entered 15Enter a floating point number:abcInvalid number, please try again:2.3abcInvalid number, please try again:2.3You entered: 2.30Enter a floating point number between 10.00 and 20.00:9.99Invalid value, 10.000000< value < 20.000000:20.1Invalid value, 10.000000< value < 20.000000:15.05You entered: 15.05End of tester program for milestone one!MS1 SUBMISSION:To test and demonstrate execution of milestone 1, use the same data as the output exampleabove.If not on matrix already, upload youripc_ms1.cto your matrix account. Compile and run yourcode and make sure everything works properly.Before submission comment out your main function (the tester) inipc_ms1.c. (Only the 9functions you implemented are needed for the submission)Then run the following script from your account: (replace profname.proflastname with yourprofessors’s Seneca userid)~profname.proflastname/submit ipc_ms1 <ENTER>and follow the instructions.
7MILESTONE 2: THE APPLICATION USER INTERFACE (DUE SAT 5TH)Download or Clone milestone 2 fromhttps://github.com/Seneca-144100/IPC_MS2and copythe functions in milestone 1 intoipc_ms2.c.Now that the user interface tools are created and tested, we are going to build the mainskeleton of our application. This application will be a menu driven program and will work asfollows:1-When the program starts the title of the application is displayed.2-Then a menu is displayed.3-The user selects one of the options on the Menu.4-Depending on the selection, the corresponding action will take place.5-The Application will pause to attract the user’s attention6-If the option selected is not Exit program, then the program will go back to option 27-If the option selected is Exit program, the program ends.The above is essentially the pseudo code for any program that uses a menu driven userinterface.To accomplish the above create the following three functions:intyes(void)Receives a single character from the user and then clears the keyboard(clrKyb()).Ifthe character read is anything other than “Y”, “y”, “N” or “n”, it will print an errormessage as follows:>Only (Y)es or (N)o are acceptable:<and goes back to read a character until one of the above four characters is received.Then, it will return 1 if the entered character is either “y” or “Y”, otherwise it will return0.
8ReadCHIf CH is neither ofY,y,N or nStartyes()HaveCHas a CharacterSet integerRETto0Print errormessageReturnRETTrueTrueFalseFalseRepeatWhileCHisneither ofY,y,NornSetRETto1ifCHis eitherYoryCall clrKyb()
desklib-logo
You’re reading a preview
card-image

To View Complete Document

Become a Desklib Library Member.
Subscribe to our plans

Unlock This Document