Home » C# programs | Computer Science homework help

C# programs | Computer Science homework help

Please be advised that there are four (4) programs just like this one that are required. Please follow the instructions listed in each word document. The programs build upon one another and need to be saved to a zip file just like the zip file labeled “CIS247_WK2_Lab_Rosado.zip”. Zip file CIS247_WK2_Lab_Rosado.zip is the program from which you start to build from.

 

STEP 1: Understand the UML Diagram

Analyze and understand the object UML diagram, which models the structure of the program.

  • There are no design changes to the Presentation Tier from the previous project and InputUtilities and ApplicationsUtilities classes are used without modification (except for changing the Application Information).
  • The default values for each of the attributres have been declared as a constants, which is indicated by the ALL_CAPS in the name, and the attributes are then set using the default values
  • Each of the attributes have been specified as private.
  • The accessors (get) and mutators (set) are not shown on the class diagram, but it is ASSUMED that each private attribute has a corresponding property that contains the get and set methods.
  • The “static” modifier for the numEmployees attribute means that there is only one copy of the variable that is then shared by all the objects of the class.
  • There is a second CalculatePay method that overloads the existing CalculatePay method
  • While not shown on the class diagram, the property for numEmployees will only have a get method, which means it will be a “read only” method. (A property with only and set method is a “write-only” property).

Image Description

What is depicted is a single column table with 3 rows. In the first row is the large word “Employee”.

In the row beneath this is a list of private parameters, indicated with a “minus” symbol before them (but no space after). These are:

-MIN_DEPENDENTS int =0
-MAX_DEPENDENTS int = 10
-MIN_SALARY double = 20000
MAX_SALARY double = 20000
DEFAULT_NAME string = “Not given”
DEFAULT_GENDER char=”U”
-firstName : String
-lastName : string
-gender : char
-dependents : int
-annualSalary : double
-static numEmployees: int = 0

In the third and final row beneath this is another list of public parameters, indicated with a “plus” symbol before them (but no space after). These are:

+Employee()
+Employee(in first : string, in last : string, in gen : char, in dep : int, in salary : double)
+ToString : string
+CalculateWeeklyPay() : double
+CalcuateWeeklyPay(modifiedSalary double)

Press the ESC key to close the image description and return to lecture.

 

STEP 2: Create the Project

You will want to use the Week 2 project as the starting point for the lab. To do this, you will want to create a new project by following these steps:

  1. Create a new project named “CIS247_WK3_Lab_LASTNAME”. An empty project will then be created.
  2. Delete the default Program.cs file that is created.
  3. Click on Project->Add Existing Item…. Select the .cs files containing the InputUtilities, ApplicationUtilities, Employee, and Program classes from your project folder from last week’s lab.
  4. The namespaces for the classes should all be “Employee”, but you should verify that the namespaces for all the classes are the same.
  5. Update the program information in the ApplicationUtilities.DisplayApplicationInformation method to reflect your name, current lab, and program description.
  6. Build and execute the project.

For each week’s assignments you will follow these steps create a new project that reuses the program from the previous week.

STEP 3: Modify the Employee

Be sure you follow proper commenting and programming styles (header, indentation, line spacing, etc.).

Using the Employee class diagram as a guide modify the Employee class:

  1. Add the constants to the class using the following as an example:

    public const double MIN_SALARY = 20000;

  2. In the default constructor, update assignment statements to use the defined constants
  3. Change all the employee class attributes to private.
  4. Create a private static numEmployees variable and initialize it to zero
  5. Increment numEmployees by 1 in each of the constructors
  6. For each private attribute, create a well-named property that contains the get and set methods. The get method of the property only needs to return the value of the attribute; but the set method of each property needs to validate the provided value using the following validation rules:
    1. If the provided first or last values are empty, or a null value, then set the name to DEFAULT_NAME.
    2. If the provided gender value is ‘F’, ‘f’, ‘M’, or ‘m’ set the value; otherwise set the value to DEFAULT_GENDER.
    3. If the provided dependent value is between the MIN_DEPENDENTS and MAX_DEPENDENTS (inclusive) then set dependent to the provided value; if the provided value is less than MIN_DEPENDENTS set the dependents to MIN_DEPENDENTS; else if provided value is greater than MAX_DEPENDENTS set the dependents to MAX_DEPENDENTS.
    4. If the provided salary value is between the MIN_SALARY and MAX_SALARY (inclusive) the set the annualSalary to the provided value; if the provided value is less than MIN_SALARY set the annualSalary to MIN_SALARY; else if provided value is greater than MAX_SALARY set the annualSalary to MAX_SALARY.
    5. For the numEmployee attribute create a property called NumberEmployees that only contains a “get” method, external objects should NOT be allowed modify the numEmployee value. Since numEmployees is a static method, the property must be declared as static.

 

  1. In the parameterized constructor, change statements that set the attributes so that the properties are used, which ensures that attributes are validated prior to be set.
  2. Create the overloaded CalculateWeeklyPay method that accepts a double “modifiedSalary” argument. The method shall update the annualSalary attribute (use the AnnualSalary property to ensure the value is valid), and then return the updated weekly pay based on the new annual salary value.

STEP 4: Modify the Main Method

In the Main class, create code statements that perform the following operations. Be sure you follow proper commenting and programming styles (header, indentation, line spacing, etc.) and use the ApplicationUtiltities methods to logically separate the operations in the output.

To access a property of an object/class, you continue to use the DOT notation; however, a property DOES NOT require the parenthesis and you just use the assignment operator (=) to set or get the value, which makes using propertys very easy. For example to set the first name, the statement would look something like:

employee1.FirstName = “John”

To get the full name, the statement would look look something like:

theName = employee1.FirstName + ” ” + employee1.LastName

Notice, there is no use of parenethese, only the assignment operator, when using properties.

The Main method code from the previous week’s lab performed the following operations, ensure that your project correctly implements these operations before moving on the new operations for this week.

  1. Display the program information.
  2. Create an Employee object using the default constructor.
  3. Prompt for and then set the first name, last name, gender, dependents, and annual salary. Remember to use the appropriate methods in the InputUtilties class to prompt for and retreive the values.
  4. Display the employee information.
  5. Create a second Employee object using the multi-argument constructor using data of your choosing that is the correct type and within the valid ranges for each of the attributes.
  6. Display the Employee information for the second employee object.
  7. Terminate the application

Once your code is working and implements the previous week’s operations, modify the code to implement the following new requirements (updated code should implement all previous requirements except as noted below).

  1. After the first employee information is provided, display the number of employees created.
  2. Prompt the user to provide an updated annual salary for employee1, retrieve the value and invoke the overloaded CalculateWeeklyPay, and then display only the updated weekly pay.
  3. Create a third Employee object using the parameterized constructor setting each of the attributes with the following values: “Sue”, “Smith”, ‘F’, 15, 500000.0
  4. Display the employee information for the third Employee object and verify that the dependents and annual salary values have been set to the maximum values by the properties. If not, make sure you change the parameterized constructor to use the properties to set the attributes.
  5. Display the number of employees created.

STEP 5: Compile and Test

When done, compile and execute your code. Debug errors until your code is error-free. Check your output to ensure that you have the desired output, modify your code as necessary, and rebuild. The following shows some sample output, but your output may look different.

 

On-screen output display:

*********************** Employee Information **********************
First Name: John
Last Name: Doe
Gender: M
Dependents: 7
Annual Salary: $32,500.00
Weekly Pay: $625.00
total employees: 1
*********************** Employee Information **********************
First Name: Mary
Last Name: Noia
Gender: F
Dependents: 5
Annual Salary: $24,000.00
Weekly Pay: $461.54
Total Employees:2
*********************** Employee Information **********************
First Name: Sue
Last Name: Smith
Gender: F
Dependents: 10
Annual Salary: $100,000
Weekly Pay: $1,923.00
Total Employees:3

Press the ESC key to close the image description and return to lecture.

 

STEP 6: Submit Deliverables

  • Capture the output window and paste it into a Word Document.
  • Put the zip file and screen shots (Word document)







Place your order
(550 words)

Approximate price: $22

Calculate the price of your order

550 words
We'll send you the first draft for approval by September 11, 2018 at 10:52 AM
Total price:
$26
The price is based on these factors:
Academic level
Number of pages
Urgency
Basic features
  • Free title page and bibliography
  • Unlimited revisions
  • Plagiarism-free guarantee
  • Money-back guarantee
  • 24/7 support
On-demand options
  • Writer’s samples
  • Part-by-part delivery
  • Overnight delivery
  • Copies of used sources
  • Expert Proofreading
Paper format
  • 275 words per page
  • 12 pt Arial/Times New Roman
  • Double line spacing
  • Any citation style (APA, MLA, Chicago/Turabian, Harvard)

Our guarantees

Delivering a high-quality product at a reasonable price is not enough anymore.
That’s why we have developed 5 beneficial guarantees that will make your experience with our service enjoyable, easy, and safe.

Money-back guarantee

You have to be 100% sure of the quality of your product to give a money-back guarantee. This describes us perfectly. Make sure that this guarantee is totally transparent.

Read more

Zero-plagiarism guarantee

Each paper is composed from scratch, according to your instructions. It is then checked by our plagiarism-detection software. There is no gap where plagiarism could squeeze in.

Read more

Free-revision policy

Thanks to our free revisions, there is no way for you to be unsatisfied. We will work on your paper until you are completely happy with the result.

Read more

Privacy policy

Your email is safe, as we store it according to international data protection rules. Your bank details are secure, as we use only reliable payment systems.

Read more

Fair-cooperation guarantee

By sending us your money, you buy the service we provide. Check out our terms and conditions if you prefer business talks to be laid out in official language.

Read more