Lab 2

09 Nov

The Scenario

As long as we are creating piecework workers, it makes sense to utilize some concepts of object-oriented programming. We are going to define our piecework workers as a Class. This is the creating the business logic tier of a two-tier application. There are also some changes to the way that workers are paid.

This Lab is a direct extension of Lab 1. Ensure you are familiar with the Lab 1 requirements prior to reading and attempting this Lab.

Business Tier – Piecework Worker Class

  • Start by creating a new Class file
  • Include both a default Constructor and a Parameterized Constructor
    • The Parameterized Constructor should take arguments and set private instance variables for the worker’s name and number of messages
  • You will also have to create shared class variables to hold the total number of employees processed, total of all calculated pay, and total number of messages sent
  • Create property procedures for both the number of messages and the worker name for access to the object variables; these should be Read-Write properties
  • Create a variable and a read-only property procedure for each individual worker’s calculated pay
  • Create Shared, Read-Only property procedures for all of the summary data – total number of employees, total of all calculated pay, and total number of messages sent
  • Include a method to calculate the total pay based on the number of messages sent using the payment plan from Lab 1
  • This calculate pay method should also update all Shared, summary properties based on the number of messages passed to the business tier for an object

Payment Scheme Changes

As only a small amount is paid per message, the payment scheme must change from what the original application was using to the following:

Messages Sent Price Paid Per Message for All Messages
1 – 199 .15
200 – 399 .18
400 – 599 .21
600 or more .25


Operation – Pay Calculation

  • The user will enter the worker name and number of messages at the presentation tier, just as they did in part of Lab 1
  • Validation for both of these fields should be moved to the business logic tier, as a part of this Class
    • Validate that something has been entered for the worker’s name in the Set part of the property procedure for the worker’s name
    • Validate that the number of messages is a whole number greater than 0 in the Set part of the property procedure for the number of messages
  • Inside the business tier, your parameterized constructor should set the two properties using property procedures, and then call the method to calculate pay which will set the total pay property for that worker object and update the shared summary properties

Updating the Existing Program

  • Changes will need to be made to get this to work with the form from Lab 1; these shouldn’t be too hard!
  • When the Calculate button is clicked, pass the textbox values as parameters to create a new instances of the Piecework Worker class
  • When the Summary button is clicked, access the read-only properly procedures for the summary values

Additional Considerations

  • The program must be adequately documented:
    • functions should all have block comments
    • calculations, decisions and iteration should be explained with brief comments
    • there should be a header at the top of the file including your name, the last modified date, and a description
  • Consider an approved style guide and ensure your variable names and other elements are properly cased and adequately descriptive

Enhancements for Stock

  • 2 bonus stock if the payment plan is implemented with single-dimensional arrays
  • 3 bonus stock if submitted with a useful planning document, including reasonably complete pseudocode and/or a flowchart
Leave a comment

Posted by on November 9, 2016 in academic writing, Uncategorized


Tags: , , ,

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: