C1S247 Lab 3 in C# – Guaranteed 100% score

Lab Price = $8
Please feel free to send us your queries at: [email protected]
Payment methods

Add to Cart

Buy Now

View Cart

Problem Statement
Week 3: Classes and Encapsulation – iLab
Lab 3 of 7: Overloaded Methods and Static Methods / Variables
i L A B O V E R V I E W
Scenario and Summary
The objective of the lab is to take the UML Class diagram and enhance last week’s Employee class by making the following changes:
1. Create a static variable called numEmployees that holds an int and initialize it to zero. This will allow us to count all the Employee objects created in the main class.
2. Increment numEmployees in all of the constructors.
3. Add an overloaded method of CalculatePay that will accept a new, or modifed, annual salary value. We will then have two versions of the CalculatePay method (1) that uses the current value of the annual salary for the calculation and (2) one that updates the annual salary with a new value before the calculation.
4. Using properties add accessor (get) and mutator (set) methods to access each of the private attributes and to validate the attribute values before they are set.
Due this week:
• Before you post your lab in the dropbox, copy your entire program into a Notepad file and post that. I do not need you to zip the project or give me screen shots of the output.
i L A B S T E P S
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
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.) that are specified in the Programming Conventions and Standards guide.
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:
a. If the provided first or last values are empty, or a null value, then set the name to DEFAULT_NAME.
b. If the provided gender value is ‘F’, ‘f’, ‘M’, or ‘m’ set the value; otherwise set the value to DEFAULT_GENDER.
c. 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.
d. 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.
e. 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.
7. 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.
8. 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.

Image Description
STEP 6: Submit Deliverables

• Before you post your lab in the dropbox, copy your entire program into a Notepad file and post that. I do not need you to zip the project or give me screen shots of the output.
Submit your lab to the Dropbox located on the silver tab at the top of this page. For instructions on how to use the Dropbox, read these Step-by-Step Instructions or watch this Dropbox Tutorial.

See Syllabus “Due Dates for Assignments & Exams” for due date information.

Relevant Material

CIS247 Lab 3 Ouput
CIS247 Lab 3 Ouput
* If you want to purchase multiple products then click on “Buy Now” button which will give you ADD TO CART option.Please note that the payment is done through PayPal.
* You can also use 2CO option if you want to purchase through Credit Cards/Paypal but make sure you put the correct billing information otherwise you wont be able to receive any download link.
* Your paypal has to be pre-loaded in order to complete the purchase or otherwise please discuss it with us at [email protected].
* As soon as the payment is received, download link of the solution will automatically be sent to the address used in selected payment method.
* Please check your junk mails as the download link email might go there and please be patient for the download link email. Sometimes, due to server congestion, you may receive download link with a delay.
* All the contents are compressed in one zip folder.
* In case if you get stuck at any point during the payment process, please immediately contact us at [email protected] and we will fix it with you.
* We try our best to reach back to you on immediate basis. However, please wait for atleast 8 hours for a response from our side. Afterall, we are humans.
* Comments/Feedbacks are truely welcomed and there might be some incentives for you for the next lab/quiz/assignment.
* In case of any query, please donot hesitate to contact us at [email protected].
* MOST IMPORTANT Please use the tutorials as a guide and they need NOT to be used for any submission. Just take help from the material.
******************************************** Good Luck ***************************************************
Privacy Policy
We take your privacy seriously and will take all measures to protect your personal information.
Any personal information received will only be used to fill your order. We will not sell or redistribute your information to anyone.
Refund Policy
Incase you face any issues with the tutorial, please free to contact us on [email protected]
We will try our best to resolve the issue and if still persists we can discuss for a refund in case its required.
Lab Price = $8
Please feel free to send us your queries at: [email protected]

Payment methods

Add to Cart

Buy Now

View Cart

Leave a Reply