Lab Week 4 Payroll Application with user-defined methods

QUESTION

Lab Week 4Payroll Application with user-defined methods using ref and out parametersTo code, build, and execute an application that calculates an employee’s weekly payroll information using user-defined methods.Learning outcomes:1. Distinguish between value, ref, and out parameter types.2. Call class methods using value, ref, and out parameters.3. Write your own class methods using value, ref, and out parameters.4. To be able to define and use global named constants.5. To be able to debug a program of syntax and logic errors.6. To be able to use the debug step-into feature to step through the logic of the program and to see how the variables changes values.Lab Narrative:For this assignment you will take Lab #3 and make use of passing by value, by ref, and by out. Use the method names in the following hierarchy chart as your method names in your program. [Note: it will be up to you to decide how you want to pass parameters. However, in general, if the variable passed to a method does not change, they pass by value.] For this lab you must illustrate both passing by ref and passing by out.You are also required for this lab to define some global named constants for the federal income tax rate and the social security tax rate. Use this named constants in your calculations.Hierarch chartUse the same data sets as you did in Labs #2 and #3. When testing your program use the debug step-into feature to step through the logic of the program and to see how the variables changes values.Data sets From Labs #2 and #3Lab 2Data Set 1: Data Set 2:Employee: James Bond Employee: Barbara BushRegular hours: 40 Regular hours: 35.5Overtime hours: 8 Overtime hours: 0Hourly pay rate: 14.50 Hourly pay rate: 10.75Lab 3Recall that in Lab #2 you developed an application to calculate an employee’s weekly payroll information using the following standard set of formulas:• gross pay = regular hours * hourly pay rate + overtime hours * 1.5 * hourly pay rate• federal income tax withholding = 28% of gross pay• Social Security tax withholding = 7.65% of gross pay• net pay = gross pay – (federal income tax withholding + social security tax withholding)For this lab, Lab #3, you will develop a program to similarly prompt the user for the required data inputs, perform exactly the same payroll calculations, and generate exactly the same formatted output as you did in Lab #2. However, instead of coding all the statements in the Main() method, you must instead call methods that do very specific jobs. This requires your program to pass all pertinent parameters to appropriate methods and return resulting values where appropriate to the Main() method. If you succeed in doing this, it will essentially leave nothing in your Main() method except for calls to other methods along with some local variables.Use the following hierarchy chart to divide up your program into separate user-defined methods. Note that the Main() method will call ten user-defined methods.Before you start to code, you need to determine what gets passed to each method and what gets returned. Some methods will not return anything, which means they will be void methods. Some methods will not receive anything, but they will return a resulting value. Finally some methods will both receive parameters and return a resulting value.Use the same data sets as you did in Lab #2. When testing your program use the debug step-into feature to step through the logic of the program and to see how the variables changes values.Lab Week 5Payroll Application with user-defined methods, if statements, and a do-while loopTo code, build, and execute an application that calculates an employee’s weekly payroll information using user-defined methods, if statements, and a do-while loop.7. Examine equality, relational, and logical operators used with conditional expressions.8. Write if selection type statements to include one-way, two-way, and nested forms.9. Write a do-while loop structure.10. To be able to debug a program of syntax and logic errors.11. To be able to use the debug step-into feature to step through the logic of the program and to see how the variables changes values.12. Instead of prompting the user to enter both regular hours and overtime hours, you will instead only ask the user to input the number of total hours worked for the week. Of course, you will still need to prompt for the hourly pay rate and employee name. The output results should be the same as if the user separately entered regular hours and overtime hours, but asking the user only for the number of total hours will require you to make some modifications to the code logic.13. In this assignment we are also going to apply a complex set of withholding rules that are in proportion to the graduated Federal Income Tax Withholding (FITW) percentages from an actual Internal Revenue Service (IRS) tax schedule*. The following set of withholding rules should be “embedded” into the appropriate section of your code logic (CalcFedTax method):If weekly gross is over and up through withhold this amount for FITW:0 504.81 15% of gross pay amount504.81 1222.12 $75.72 plus 28% of amount over $504.811222.12 2550.00 $276.57 plus 31% of amount over $1222.122550.00 5545.19 $688.21 plus 36% of amount over $2550.005545.19 ———- $1766.48 plus 39.6% of amount over $5545.1914. * The set of withholding rules implemented in this lab exercise is purely hypothetical, but provides a good exercise in applying multi-way selection statements. In reality, when you set up your federal income tax withholding with your employer, you actually fill out an IRS Form W-4 indicating your number of “Personal Allowances” based on your individual financial situation. Your employer withholds an amount based on a more complex set of rules built into the IRS “Personal Allowances Worksheet” that helps you determine your number of Personal Allowances. If you’re curious, you can check out the latest Federal Income Tax Schedule tables, Form W-4, and Personal Allowances Worksheet at www.irs.gov.15. Social Security tax withholding will be calculated as 7.65% of gross pay. (Use a named constant for this standard tax deduction.)16. Net pay = gross pay – (federal income tax withholding + social security tax withholding)17. Follow the hierarch chart below and use the method names indicated in the hierarchy chart. Notice that this lab includes a do-while loop. In addition, notice that the PayCalcs method calls CalcFedTax. Finally, notice that the GetUserChoice will prompt the user to see if the loop continues.18. 19. .20. Run your final debugged program showing the results for the following setEmployee Name: Kenny BrooksHours Worked: 50Hourly Pay Rate: 45.4521. Employee Name: Justin HaleHours Worked: 40Hourly Pay Rate: 8.50Employee Name: Shannon JohnsonHours Worked: 30Hourly Pay Rate: 10.00Here is a sample of how your program may look like. Notice how the user is prompted to continue or quit. In addition, there is a separate line between each employee for readability. Check with your instructor as to the requirements of spacing and readabilityLab Week 6A. Lab 6 of 7: Array Application B. Lab Overview – Scenario / SummaryTo code, build, and execute an application that initializes some parallel arrays, then sorts the arrays using a bubble sort. This lab will then prompt the user for a value, which is used to search one of the arrays. Information is then extracted from the parallel arrays and displayed.Learning outcomes:22. Declare arrays and load values into an array.23. Access elements of an array.24. Write methods that use arrays as parameters.25. Sort arrays.26. Search arrays for specific values.27. Be able to use the debug step-into feature to step through the logic of the program and to see how the variables changes values.C. Lab Narrative:Sometimes, programmers use parallel arrays in programs that must track more than one list of values that are related. For instance, suppose that you wanted to keep track of all the item numbers, item descriptions, and item prices for all the cars of a Honda Dealer. This would require three arrays: an item number array, a description array, and a price array. The following table illustrates what these arrays would contain:ITEM NUMBER ITEM DESCRIPTION ITEM PRICE20 Accord 20000.0060 S2000 39000.0010 Civic 18000.0050 Pilot 35000.0040 Odyssey 30000.0030 Station Wagon 24000.00Suppose you also wanted to be able to input an item number for a particular model of Honda and the quantity on hand, and then be able to display what the inventory value would be for that particular model [Inventory value would equal quantity on hand times item price.]Following the hierarchy chart below, write a program in C# that would accomplish this scenario.Instructions:1. In the Main() method define and initialize three arrays with the values indicated on page 1. They must be initialized in the order as indicated above.2. In the Main() method call the methods as indicated in the hierarchy chart. [Note: you will need to pass the appropriate arrays and other variables to these methods.3. The purpose of the Sort() method is to sort the item number array in ascending order. When swapping the item numbers you will also swap the corresponding description and price.4. The purpose of the List() method is to display the sorted arrays. [If you look at the last page of this handout you will see how these arrays are displayed. You are required to list your arrays just like the example shows, with the columns aligned and spaced properly for readability.]The following three methods will be called inside a do/while loop in order to allow the user multiple lookups.5. The purpose of the GetInput() method is to input the item number (this will be your search argument) and quantity on hand. These variables will need to be passed back to Main().6. The purpose of the Lookup() method is to:• Take the item number that was entered in the GetInput() method and lookup this number in the item number array.• If the item number is found, then you will calculate total inventory value by multiplying the quantity on hand times the price from the item price array. You will then display the inventory value of this model. [Again, if you look at the last page of this handout you will see how this is displayed. You are required to display this information just like the example shows, with the columns aligned and spaced properly for readability.]• If the item number is not found, then you simply display the message “Sorry – item number not found! Please try again.Note: you will need to pass the item number and quantity on hand, which you got from the GetInput() method; and arrays to the Lookup() method.7. The purpose of the GetUserChoice is to ask the user if he wants to continue or quit.8. You must also make use of local variables and arrays and pass the necessary information to the methods. It will be up to you as to whether to use pass by value, pass by reference, or pass by out.9. Make sure you test for at least one item number found and at least one item number not found.Screen Layout Chart – Use this to help you determine where things are displayed.Sample Output

 

ANSWER:

REQUEST HELP FROM A TUTOR

Expert paper writers are just a few clicks away

Place an order in 3 easy steps. Takes less than 5 mins.

Calculate the price of your order

You will get a personal manager and a discount.
We'll send you the first draft for approval by at
Total price:
$0.00