using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Chapter8_Prob_8
{
class Program
{
const int MAX_SIZE = 7;
static void Main(string[] args)
{
double[] empId = new double[MAX_SIZE] { 56588, 45201, 78951, 87775, 84512, 13028, 75804 };
//the book calls for an integer array to hold the number of hours worked by each employee
//this is unrealistic to use an integer, I need more points of accuracy. I will use a double.
double[] hours = new double[MAX_SIZE];
double[] payRate = new double[MAX_SIZE];
double[] wages = new double[MAX_SIZE];
//function to get the hours of the employees
getHoursAndPay(empId, hours, payRate);
calcWages(hours, payRate, wages);
displayResults(empId, hours, payRate, wages);
}//end main
Instead of using calcWages(hours, payRate, wages);
would it be possible to have something like,
wages = calcWages(hours, payRate) and then have a function that would return
each 'wage' into each element of the array?
Instead of using calcWages(hours, payRate, wages);
would it be possible to have something like,
wages = calcWages(hours, payRate) and then have a function that would return
each 'wage' into each element of the array?
Vikram AgrawalPosted Mar 30, 2015, 5:54 AM
Hi Scott,
As per your requirement you can try following code. I hope it will be helpful to you.
your calcWages metho should be like this :
public List calcWages(double[] hours, double[] payRate) wageList = new List();
{
List
for ( int i=0; i< MAX_SIZE ; i++)
{
// Code for calculating wages
wageList.Add(CalculateWage);
}
return wageList;
}
Thanks