Answer:
The method definition to this question as follows:
Method definition:
//method GetData
public static void GetData(out int order, out int amount)//defining method GetData
{
String val1, val2; //defining String variable
Write("Enter order number "); //message
val1 = ReadLine(); //input value by user
Write("Enter quantity "); //message
val2 = ReadLine(); //input value by user
order = Convert.ToInt32(val1); //convert value in integer and hold in order variable
amount = Convert.ToInt32(val2); //convert value in integer and hold in amount variable
}
Explanation:
In the above C# method definition code a method GetData() is defined in which the GetData() method is a static method, in this method parameter two integer argument "order and amount" is passed, inside a method, two string variable "val1 and val2" is declared that is used to take input by the user and convert the value into integer and store this value in the function parameter variable.
Answer:
#include <iostream>
using namespace std;
void swap(int *a,int *b)
{
int temp;
temp=*a;
*a=*b;
*b=temp;
}
bool consecutive(int k1,int k2,int k3)
{
int arr[]={k1,k2,k3}; //storing these variables into an array
int i,j;
for(i=0;i<3;i++)
{
for(j=i;j<3;j++)
{
if(arr[i]>arr[j])
{
swap(arr[i],arr[j]); //swapping to sort these numbers
}
}
}
if((arr[1]==arr[0]+1)&&(arr[2]==arr[0]+2)) //checks if consecutive
return true;
else
return false;
}
int main()
{
int result=consecutive(6,4,5); //storing in a result variable
if(result==0)
cout<<"false";
else
cout<<"true";
return 0;
}
OUTPUT :
true
Explanation:
In the above code, it stores three elements into an array and then sorts the array in which it calls a method swap() which is also defined and interchanges values of 2 variables. Then after sorting these numbers in ascending order , it checks if numbers are consecutive or not, if it is true, it returns true otherwise it return false.
Answer:
Mean = 91044.915
Median = 22750
Explanation:
See exhibit 1 in attachment for explanation.