Ask Question
20 June, 03:22

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

+2
Answers (1)
  1. 20 June, 03:40
    0
    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.
Know the Answer?
Not Sure About the Answer?
Find an answer to your question 👍 “What is the output of the following program segment? int main () {float hours = 8; float payRate = 5.5; / / per hourfloat grossPay = 0.0; ...” in 📗 Computers & Technology if the answers seem to be not correct or there’s no answer. Try a smart search to find answers to similar questions.
Search for Other Answers