Green Land Cap Ing Assignment

Embed Size (px)

Citation preview

  • 8/3/2019 Green Land Cap Ing Assignment

    1/27

    Veliyaphi Quinton Nhlengethwa

    00126826

    Landscape gardener

    2011

    Veliyaphi Nhlengethwa

    IDM Swaziland

    8/19/2011

    Programming methods

  • 8/3/2019 Green Land Cap Ing Assignment

    2/27

    Table of contents

    Page

    Task 1 ......................................................................................................................... 3

    Task 2 ........................................................................................................................ 11

    Task 3 ........................................................................................................................ 13

    Task 4 ......................................................................................................................... 16

    Task 5 ......................................................................................................................... 18

    Task 6.......................................................................................................................... 23

    Bibliography................................................................................................................. 26

    2

  • 8/3/2019 Green Land Cap Ing Assignment

    3/27

    TASK 1

    Question

    The owner would like the following reports on a regular basis:

    Report 1:

    A weekly list of all customers using the companys services that week to include, hourly

    rate, number of hours worked, details of job carried out and the payment made. This report

    should also give a total of hours worked for the week and total payment due.

    Report 2:

    A weekly list of all employees working that week to include name, hourly rate, number of

    hours worked and the payment due. This report should also give a total of the hours worked

    and total payment due.

    Using JSP techniques and methodology analyse the requirements of both reports. Produce

    diagrams for each report showing the step-wise progression. Diagrams should include:

    Logical data structure diagrams (DSDs)

    3

  • 8/3/2019 Green Land Cap Ing Assignment

    4/27

    Answer

    The physical data structure Diagram for Green Landscaping

    Figure 1.1: Physical data structure diagram for Green landscaping company

    4

    Company

    records

    Employee

    s records

    Customer

    s records

    Jobs

    records

    Employees

    Customers

    Reservations

    Green

    Landscaping

    Reservatio

    ns records

    Jobs

    Name Addres

    Regula

    Once-

    Name Addres

    Type

    Patios Gardeni

    Paving Plantin

  • 8/3/2019 Green Land Cap Ing Assignment

    5/27

    Logical data structure diagram for report 1 (customers)

    Figure 1.2: Logical data structure diagram for customers

    Logical data structure diagram for report 2 (employees)

    5

    Customer

    Once-off

    Customer

    Regular

    Customer

    WeeklyCustomer

    MonthlyCustomer

    Fixed hourly

    rate

    Job done

    Fixed hourly

    rate

    Hourly rate

    according to

    job done

    Hoursworked

    Payment

    due

    Payment

    due

    Hoursworked

    Hoursworked

  • 8/3/2019 Green Land Cap Ing Assignment

    6/27

    Figure 1.3: Logical data structure diagram for employees

    Preliminary program structures.

    Preliminary program structure for report 1 (customers)

    6

    Employees

    Director Other

    Employees

    Name Hours worked

    Payment due

    Hourly rate

    Hours worked

    Payment due

    Customer

    report

    ProcessingInitializing ClosingOpen files Print

    headings

    Process

    records of

    each

    customer

    Print footer Close filesCustomer

    details

    Total hours

    worked

    Print line

    on the

    Total

    payment

    Job done

  • 8/3/2019 Green Land Cap Ing Assignment

    7/27

    Figure 1.4: Preliminary program structures for customers

    Preliminary program structure for report 2 (employees)

    7

    Employees

    report

    ProcessingInitializing ClosingOpen all files Print

    headings

    Process

    records for

    Print footer Close all filesEmployees

    details

    Total hours

    worked

    Print a line

    on the report

    Total

    payment due

  • 8/3/2019 Green Land Cap Ing Assignment

    8/27

    Figure 1.5: Preliminary program structure for employees

    The detailed program specification for each report.

    According to Gary B. Shelly 2007

    Program specifications for report 1 (customers)

    Date submitted:

    15 August 2011

    8

  • 8/3/2019 Green Land Cap Ing Assignment

    9/27

    Application title:

    Customer report

    Purpose:

    The program categorise customers and then calculate payment due according to

    nature of job done against hours worked.

    Program procedure:

    In a Windows application the user/ owner should enter the customer name, whether he is a

    once-off or regular customer, nature of job done and hours worked and charge per hour. If

    the customer is a once-off customer then the pay/ charge should be calculated according to

    nature of job done and the hourly rate. If he is a regular customer he can either be a weekly

    or a monthly customer, whose charge will be calculated not according job done but only

    according to hours worked. The programme or application should compute and display the

    payment due either in once-off customers and regular customers.

    Algorithms, Processing and Conditions

    1. The user/ owner should be able to enter customer name, hours, nature of job and

    rate per hour.

    2. The user/ owner should be able to indicate whether its a once-off or regular

    customer.

    3. The user/ owner should be able to initiate the calculation and the display of the

    payment due based on whether he is a once-off customer or regular customer.

    4. The program should be able to print the results or report.

    5. The program should be able to clear the inputs and results after the owner is done.

    Program specifications for report 2 (employees)

    Date submitted:

    15 August 2011

    Application title:

    9

  • 8/3/2019 Green Land Cap Ing Assignment

    10/27

    Employee report

    Purpose:

    The program should list all employees working that week and then calculate salary/ payment

    due according to hours worked.

    Program procedure:

    In a windows application the user/ owner should enter the employees name, hours worked

    and pay per hour. The program should compute and display the payment due.

    Algorithms, Processing and conditions:

    1. The user/ owner should be able to enter employee name, hours worked and rate perhour.

    2. The user/ owner should be able to initiate the calculation and display the payment,

    salary due.

    3. The program should be able to print the results or report.

    4. The program should be able to clear the input and the results after the owner is done.

    ( Gary B. Shelly 2007)

    TASK 2

    Question

    Draw a flowchart for each of the two reports specified in task 1.

    10

  • 8/3/2019 Green Land Cap Ing Assignment

    11/27

    Answer

    Flow chart for report 1 (customers)

    start

    Entercustomer

    name ,

    Regular

    customer

    Get hoursworked & rate

    per hour

    Calculate paymentdue

    Get nature ofjob, hours

    worked &hour rate

    Calculate paymentdue according to

    job done

    Print report

    End

    No Yes

    Clear inputs andresults

    Until all

    Customers

    Are finished

    Figure 2.1 Flowchart for customers

    Flow chart for report 2 (employees)

    11

  • 8/3/2019 Green Land Cap Ing Assignment

    12/27

    start

    Enter name, get

    hours worked

    and rate perhour

    Employee = 3 Calculate payment Increment

    Display

    payment

    Print report

    End

    No

    Yes

    Figure 2.2 Flowchart for employees

    TASK 3

    Question

    12

  • 8/3/2019 Green Land Cap Ing Assignment

    13/27

    a) Write pseudocode for each of the two reports described in Task 1.

    Answer

    (i) Pseudocode for report 1 (customers)

    Use variables: customer type OF TYPE Character

    hours worked, hourly rate, payment due and nature of job OF TYPE Real

    name OF TYPE String

    Display Type one of the following

    Display O=Once-off customer

    Display R=Regular Customer

    REPEAT

    DISPLAY enter customer name

    ACCEPT name

    DISPLAY type in the letter chosen

    DISPLAY O := once-off customer

    DISPLAY R := regular customer

    ACCEPT customer type

    IF customer type = O

    THEN payment due := hours worked*hourly rate, according to job done.

    ENDIF

    IF customer type = R

    THEN payment due := hours worked*hourly rate

    ENDIF

    UNTIL customer := 0

    13

  • 8/3/2019 Green Land Cap Ing Assignment

    14/27

    DISPLAY payment due for once-off customers

    DISPLAY payment due for regular customers

    END Program

    (ii)Pseudocode for report 2 (customer)

    Use variables: name OF TYPE String

    Hours worked, hourly rate and payment due OF TYPE Float

    REPEAT

    DISPLAY enter customer name

    ACCEPT name

    DISPLAY get hours worked

    ACCEPT hours worked

    DISPLAY get hourly rate

    ACCEPT hourly rate

    Payment due := hours worked * hourly rate

    PRINT payment due

    END Program

    Question

    b) Write pseudocode for a reports main menu. Note: you are not expected to writepseudocode for the options, only the code to navigate the menu is required.

    14

  • 8/3/2019 Green Land Cap Ing Assignment

    15/27

    Answer

    Pseudocode for the main menu

    Main Menu

    DISPLAY Customer Report

    DISPLAY Employee Report

    DISPLAY Exit

    ACCEPT Choice

    IF choice Customer Report

    Then Customer Report = Customer Report

    ENDIF

    IF choice Employee Report

    THEN Employee Report = Employee Report

    ENDIF

    ELSE invalid

    ENDPROGRAM

    15

  • 8/3/2019 Green Land Cap Ing Assignment

    16/27

    TASK 4

    Question

    Test the pseudocode written in task 3a by producing test plans, desk checks and dry runs.

    Answer

    Report 1 test plan

    Purpose

    The purpose of this test plan is to ensure a weekly report of customers using THE GREEN

    LANDSCAPING companys services is printed.

    Items to be tested

    o Requirements specification

    o Design specification

    Features to be tested

    o Calculating and printing of reports/ payment due.

    o Printing of customer details.

    o Printing of service details.

    o Calculating and printing of hours worked.

    Pass / fail criteria

    o Printing of full customer and job details.

    o Printing of report totals.

    Employee Customer Job Hourly rate Hours

    worked

    Payment

    due

    1 001 Patio 140 9 12602 002 Pool 100 5 500

    16

  • 8/3/2019 Green Land Cap Ing Assignment

    17/27

    3 003 Planting 120 6 720

    Total 20 2480

    Table 4.1: Test plan

    Report 2 Test plan

    Purpose

    The purpose of this test is to ensure a weekly report of work done by employees can be

    printed.

    Items to be tested

    o Requirements specification

    o Design specification

    Features to be tested

    o Calculating and printing of total payment due.

    o Printing of employees details.

    o Printing of job details

    o Calculating and printing of total hours worked by employees.

    Pass / fail criteria

    o Printing of full employee and job details.

    o Printing of reports.

    Employee Job Hourly rate Hours worked Payment

    1 Patio 140 8 1120

    2 Pool 100 2 200

    3 Planting 120 3 360

    Total 1680

    17

  • 8/3/2019 Green Land Cap Ing Assignment

    18/27

    Table 4.2: Report 2 test plan

    Task 5

    Question

    Give a detailed explanation of how modelling the new system using object oriented (oo)

    methods would differ from the methods used from the methods used in tasks 1-4 above.

    Create a top-level class diagram for the system including attributes and operations.

    Create a use case diagram for the system.

    Answer

    General comparison

    There are basically two approaches to system development.

    1. The object oriented approach.

    2. The traditional approach / structured system development.

    The object oriented approach

    This approach views systems as made of objects that interact with each other to perform

    system tasks.

    18

  • 8/3/2019 Green Land Cap Ing Assignment

    19/27

    Figure 5.1:

    Object oriented analysis

    Shows all the objects in the system and how they interact with each other and the users of

    the system.

    Object oriented design

    Looks for additional objects that enable interaction and how the objects communicate to

    perform system tasks.

    Object oriented programming

    Using an object oriented language to specify system objects and what they do.

    Benefits of object oriented approach

    According to structured programming methods, the benefits of object oriented approach are:

    1. Natural

    2. Reuse of objects

    The traditional approach

    According to Programming methods by NCC education, the structured traditional approach

    is made up of three techniques:

    1. Structured analysis

    2. Structured design

    19

  • 8/3/2019 Green Land Cap Ing Assignment

    20/27

    3. Modular programming

    Figure 5.2:

    Structured programming

    According to Programming methods by NCC , a structured program has one entry point an

    done exit point. Algorithms consist of three main structures.

    A. Sequence

    B. Selection

    C. Repetition

    Top-down programming

    This is where a large program is divided into smaller programs that perform single taskscalled modules. The main module calls the lower modules in a hierarchical structure.

    Structured design

    The two principles:

    o Loose coupling-each module is independent of other modules.

    o High cohesiveness-each module performs a single task.

    Modern structured analysis

    20

  • 8/3/2019 Green Land Cap Ing Assignment

    21/27

    This technique helps to determine the processing requirements and data storage

    requirements of a system. Two models are used:

    o The data flow diagram (DFD) for process model.

    o The entity relationship diagram (ERD) for data modelling.

    Disadvantages of the traditional approach

    o Process centred

    o Not comprehensive

    o There are many variations in practice.

    Top-level class diagram for the system

    21

    Employee

    Name

    Address

    GetReservation

    Reservation

    Date/time

    Job Type

    Duration

    Customer

    Employee

    Calculate Payment

  • 8/3/2019 Green Land Cap Ing Assignment

    22/27

    Figure 5.1: Top-level class diagram

    Use case diagram

    22

    Register

    Employee/custo

    mer

    PrintEmployee/customerRecord

    UpdateEmployee/customerRecord

    Add

    Employee/custo

    mer RecordDelete

    Employee/custom

    er Record

    Check

    Hourly Rate

    Log on

    Check

    Payments

    Select

    Employee/cust

    omer

  • 8/3/2019 Green Land Cap Ing Assignment

    23/27

    Figure 5.3: Use case diagram

    TASK 6

    Question

    In more than 500 words, write a review of your work. Describe any assumptions you

    have made, any weaknesses in your work and any changes you could introduce to

    improve your work. For the different methods and techniques you have used or

    described in tasks 1-5, suggest which methods would be appropriate for different

    programming languages.

    Answer

    Task 1 consists of reports on customers and employees for Green Landscape

    Gardner. These reports were produced using Logical Data Structure Diagrams (DSD)

    and Program Data Structure (PSD) showing the step-wise progressions involved.

    The Program Specification was produced for both reports.

    Task 2 is flowcharts for both reports specified in task 1. In task 3, a pseudocode for

    report 1, 2 and the main menu is produced.

    In task 4, pseudocode written in task three are tested by producing test plans, dry

    runs and desk checks.

    In task 5, UMLs are used. A high-class diagram is created for Green Landscape

    Gardners system, a high-level USE CASE analysis and USE CASE diagrams

    23

  • 8/3/2019 Green Land Cap Ing Assignment

    24/27

    produced. SEQUENCE and COLABORATION diagrams for the USE CASE

    scenarios produced.

    It was assumed that the files already exist and so the database behind the program.

    This was used throughout the assignment precisely task2and3. Therefore there wasno need to enter the entire information of employees and customers of Green

    Landscaping.

    In the pseudocodes and the flowcharts a loop was being used. According to the size

    of the files, the database can be increased or decreased as entries are added or

    deleted. This database was assumed to be a rational one since this kind of

    implementation is easier to work with. This is known as a flexible and easy to query

    database.

    Assumptions

    All employees are paid on commission. (according to work one has done,

    meaning no work no pay)

    Employees have log books where time is recorded. Job start and job finish.

    Customers pay directly to employees.

    Each employee has his own regular customers.

    Weaknesses

    There are no graphical presentations in these reports.

    The reports are not flexible to allow other information that the owner can require.

    Recommendations

    Work could have been improved by the introduction of CRC (Class Responsibility

    and Collaboration) cards in the production of reports and class diagrams in this

    assignment as shown on the site (CRC white papers). CRC cards are used toidentify various objects and classes in the system (ProgrammingMethods 2001).

    24

  • 8/3/2019 Green Land Cap Ing Assignment

    25/27

    Production of CRC cards is done through brainstorming session where system

    expects and domain expects are gathered each asked views of the system.

    These views are then filtered and the final output of CRC card is produced.

    The systems in this assignment are model using UML techniques. According to

    MartinFowler (2004), state that diagrams can also be used to in modelling

    systems. State diagrams, shows the various states or stages through which an

    object goes through a system.

    Activity diagrams could be also used for this system. Activity diagrams keep track

    of the various activities in a system as well as the decision points in the system

    (Programming methods 2001).

    Object oriented methods would be appropriated for object oriented languages

    such as such as visual basic, java++ and python.

    The structured methods would be appropriate for structured languages like

    Pascal and lower version of Visual basic such as version 6 and below.

    End

    Bibliography

    1. Visual Basic 2005,

    Gary B. Shelly, Thomas J. Cashman, Corinne Hoisington

    Published by Golgotha training services Ltd 2007

    Printed by B & Jo enterprice Pte Ltd

    Singapore

    2. Programming methods Version 1.1

    25

  • 8/3/2019 Green Land Cap Ing Assignment

    26/27

    Published by NCC education Ltd 2007

    The Towers, The Towers Business Park

    Wilmslow Road, Didsbury

    Manchester M20 2EZ

    UK

    3. Mr Paul

    IDM Visual Basic consultant

    P.O. Box 1534

    Mbabane, Swaziland H100

    4. Mr Courage

    IT consultant

    P.O. Box 1534

    Mbabane, Swaziland

    26

  • 8/3/2019 Green Land Cap Ing Assignment

    27/27