131k views
0 votes
What is the output of the following program segment?int main(){float hours = 8;float payRate = 5.5; // per hourfloat grossPay = 0.0;grossPay = calcGrossPay (hours, payRate);displayGrossPay(grossPay);return 0;}float calcGrossPay(float hrs, float payRt){return hrs * payRt;}void displayGrossPay(float gPay){cout <<"Gross Pay is "<< gPay << endl;} a. 44b. Gross Pay is 44c. Gross Pay is gPayd. All of the above

1 Answer

6 votes

Answer:

The answer is "Option b".

Explanation:

In the code firstly, the main method is declared, inside the main method three float variable is declared, that are "hours, payRate, and grossPay", in which all variable assign a value, that is "8, 5.5, and 0.0". The first two variables are used as parameters, and the third variable is used to hold and pass as a parameter in displayGrossPay function, Then two function is called that is "calcGrossPay and displayGrossPay".

  • The calcGrossPay function uses "hours and payRate" variable as a parameter, and return multiplication of value.
  • The displayGrossPay function uses a float variable "gPay" in its parameter, which is held in the grossPay variable, that holds calcGrossPay function value and print, its value.
User Fatfrog
by
4.7k points