Computer Science Sba

download Computer Science Sba

of 56

Transcript of Computer Science Sba

  • 7/30/2019 Computer Science Sba

    1/56

    Problem Definition

    The name of the business is Green Finger Gardening Supplies. It is a smallcompany. It has been in business for over ten years and currently employs twooffice workers. It is located on James Street opposite Lewis Pharmacy. As the

    name may suggest, they specify in the selling of gardening products herbicides,insecticide, fungicides and also spray cans.

    When the customer enters the store they ask for the good desired and if it is in

    stock it is sold to them. Customers can also ask to have their goods delivered foran extra charge of $5.00 or have goods reserved until they are ready to come forit for an extra charge of $3.00.

    Their sales are recorded after every working day in a note book. They subtractthe sold and reserved goods from their current stock to know the remaining stockbut doing this is very timely on a daily basis. When the stock reaches less than

    one hundred units and order is placed, but doing this manually has proven to be

    faulty as wrong stock figures have been recorded and sometimes stock is orderedtoo late and thus they run out of stock.

    The manual system was not only inefficient and unproductive but, it was timeconsuming, some information was lost and ever since the expansion data wasdifficult to record and keep track of as space was quickly depleting.

    The new computerized system promises to increase the reliability and accuracy ofdata. It has a registry which makes data input easier and faster.

  • 7/30/2019 Computer Science Sba

    2/56

    Narrative

    Create a structure called current_stock, with attributes:

    Item_name stored as a character array with size of 25

    Item_cases stored as an integer array with size of 3

    Item_units stored as and integer array with size of 4

    With instances array with size of 10 called items.

    START_main

    1. Assign the integer variable pass to the value 4649.

    2. Call function welcome.

    3. Ask the user for password.

    4. Accept from the user the password prompted for in step 2.

    5. If pass is not equal to 1010:

    a. Ask the user for password.

    b. Accept from the user the password.

    c. Repeat step 4.

    6. Call function menu.

    7. END.

    START_welcome

    1. Display to the screen welcome message

    2. END.

    START_menu

    1. Ask the user for option.

    2. Accept from the user the option and store it in the integer variable opt.

    3. If opt is equal to 1 then call function current_stock_report, if not, but option isequal to edit_stock, if not, but option is not equal to 1 or 2 then display to thescreen Invalid task and call function menu.

    4. END.

    START_current_stock_report

  • 7/30/2019 Computer Science Sba

    3/56

    1. Open file in Read mode and display to the screen the value of the variablesitem_name, cases and units from the instance items of the struct current_stock.

    2. Call function menu2.

    3. END.

    START_edit_stock

    1. Initialize u to 0.

    2. If u is less than 5 then:

    a. Ask user for option

    b. Accept from the user option and store it in the integer variable opt1.

    c. If opt1 is equal to 1 then call function fungicides, if not, but opt1 is equal to 2then call function insecticides, if not, but opt1 is equal to 3 then call function

    herbicides, if not, but opt1 is equal to 4 then call function sprayers, if not then

    display to the screen The type of item you chose is not valid.

    d. Repeat Step 2, Increment by 1.

    3. END.

    START_fungicides

    1. Initialize I to 0

    2. If I is less than 3 then:

    a. Open file fungicide stock in Read Mode and display to the screen the value ofthe variables item_name, cases and units from the instance items of the structcurrent_stock.

    b. Ask the user for the amount of sales.

    c. Accept from the user the amount of sales prompted for above and store it in

    the integer variable sales.

    d. If sales is more than the value of the variable units of the instance items thenask the user for amount of sales and accept from the user amount of sales, if not,the value of the variable newstock is equal to the subtraction of the value of thevariable sales from the value of the variable units of the instance items.

    e. If newstock is less than or equal to 10 then display to the screen The newamount of the value of the variables newstock and item_name of the instance

    items ATTENTION! Stock is low., if not, display to the screen The new amountof the value of the variables newstock and item_name of the instance items.

    f. Assign the value of the variable units of the instance items to the variablenewstock.

  • 7/30/2019 Computer Science Sba

    4/56

    g. Close File

    h. Repeat Step 2.

    3. Call function menu2.

    4. END.

    START_insecticides

    1. Initialize I to 0

    2. If I is less than 3 then:

    a. Open file insecticide stock in Read Mode and display to the screen the value ofthe variables item_name, cases and units from the instance items of the structcurrent_stock.

    b. Ask the user for the amount of sales.

    c. Accept from the user the amount of sales prompted for above and store it in

    the integer variable sales.

    d. If sales is more than the value of the variable units of the instance items thenask the user for amount of sales and accept from the user amount of sales, if not,the value of the variable newstock is equal to the subtraction of the value of thevariable sales from the value of the variable units of the instance items.

    e. If newstock is less than or equal to 10 then display to the screen The newamount of the value of the variables newstock and item_name of the instanceitems ATTENTION! Stock is low., if not, display to the screen The new amount

    of the value of the variables newstock and item_name of the instance items.

    f. Assign the value of the variable units of the instance items to the variablenewstock.

    g. Close File

    h. Repeat Step 2.

    3. Call function menu2.

    4. END.

    START_herbicides

    1. Initialize I to 0

    2. If I is less than 3 then:

    a. Open file herb stock in Read Mode and display to the screen the value of thevariables item_name, cases and units from the instance items of the struct

    current_stock.

  • 7/30/2019 Computer Science Sba

    5/56

    b. Ask the user for the amount of sales.

    c. Accept from the user the amount of sales prompted for above and store it in

    the integer variable sales.

    d. If sales is more than the value of the variable units of the instance items thenask the user for amount of sales and accept from the user amount of sales, if not,the value of the variable newstock is equal to the subtraction of the value of thevariable sales from the value of the variable units of the instance items.

    e. If newstock is less than or equal to 10 then display to the screen The new

    amount of the value of the variables newstock and item_name of the instanceitems ATTENTION! Stock is low., if not, display to the screen The new amount

    of the value of the variables newstock and item_name of the instance items.

    f. Assign the value of the variable units of the instance items to the variablenewstock.

    g. Close File

    h. Repeat Step 2.

    3. Call function menu2.

    4. END.

    START_sprayers

    1. Initialize I to 0

    2. If I is less than 3 then:

    a. Open file sprayer stock in Read Mode and display to the screen the value of thevariables item_name, cases and units from the instance items of the structcurrent_stock.

    b. Ask the user for the amount of sales.

    c. Accept from the user the amount of sales prompted for above and store it inthe integer variable sales.

    d. If sales is more than the value of the variable units of the instance items thenask the user for amount of sales and accept from the user amount of sales, if not,

    the value of the variable newstock is equal to the subtraction of the value of thevariable sales from the value of the variable units of the instance items.

    e. If newstock is less than or equal to 10 then display to the screen The newamount of the value of the variables newstock and item_name of the instanceitems ATTENTION! Stock is low., if not, display to the screen The new amountof the value of the variables newstock and item_name of the instance items.

    f. Assign the value of the variable units of the instance items to the variable

    newstock.

  • 7/30/2019 Computer Science Sba

    6/56

    g. Close File

    h. Repeat Step 2.

    3. Call function menu2.

    4. END.

    START_menu2

    1. Ask user to enter choice.

    2. Accept from the user the choice.

    3. If choice is equal to 1 then call function menu, if not, but choice is equal to 2then call function edit_stock, if not, but choice is equal to 3 then call functionfinish, if not, display to the screen The option you chose is invalid., ask user to

    enter choice and accept from the user the choice.

    4. END.

    START_finish

    1. Display to the screen GREEN FINGER GARDEN SUPPLIES.

    2. Display to the screen THANK YOU.

    3. Display to the screen GOODBYE .

    4. END.

  • 7/30/2019 Computer Science Sba

    7/56

    Flowchart Showing Welcome Function

    Pass= 1010

    Enter a Password

    If

    password!=

    pass

    Menu

    Yes

    No

    END

    START

  • 7/30/2019 Computer Science Sba

    8/56

    Flowchart showing Menu Function

    Main

    Screen

    Menu

    END

    START

  • 7/30/2019 Computer Science Sba

    9/56

    Flowchart Showing Menu2 Function

    U = 0

    If u

  • 7/30/2019 Computer Science Sba

    10/56

    If opt= 4

    Sprayers

    Display The typeof item you choseis not valid.

    u= u +1

    END

  • 7/30/2019 Computer Science Sba

    11/56

    Flowchart Showing Fungicides Function

    START

    i = 0

    If

    i