Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

**In Java Write a method, calculatePay, that accepts hours and payRate. The meth

ID: 3673218 • Letter: #

Question

**In Java

Write a method, calculatePay, that accepts hours and payRate. The method calculates and prints the gross pay.

Write a method, average, that reads in three integers and returns the average of the three integers.

Write a method, averageArray, that accepts a one-dimensional array of double and returns the average of the numbers in the array.

Write a program that calls method calculatePay with 45 hours at 25.50 and hour.

Write a program that calls method average with the values 15, 37, 89.

Write a program that calls method averageArray. You can create the array using your data.

Explanation / Answer


package average;


public class Average {

int total=0;
public Average(){
double array[]=new double[10];
int hours=45;
double payment=25.50;
for(int i=0;i<10;i++){
array[i]=2.28+i;
}
System.out.println("Gross payment is ="+calculatePay(hours,payment));
System.out.println("Average of an Array of 10 doubles is ="+averageArray(array));
System.out.println("Average of three normal integers is = "+averageNumbers(15,37,89));
}
double calculatePay(int h,double p)
{
return h*p;
}
double averageArray(double a[])
{
for(int i=0;i<10;i++)
{
total+=a[i];
}
return (total/2);
}
int averageNumbers(int x,int y,int z)
{
return ((x+y+z)/2);
}
  
  
public static void main(String[] args) {
  
Average a=new Average();
  
}
  
}