Question: The swap function from Lab 8 was coded as: void swap (int& a, int& b) {int hold ; hold = a ; a = b;

 The swap function from Lab 8 was coded as: void swap

The swap function from Lab 8 was coded as: void swap (int& a, int& b) {int hold ; hold = a ; a = b; b = hold ;} Which of the following calls to swap in main are valid? (Remember Question 8) a.) int x = 1, y = 3; swap(x, y); b.) swap (10, 5); c.) int x = 1, y = 3; swap(x, y + 5); d.) double x = 1.5, y = 3.2 swap (x, y); Code a main program and the functions to do the following: A function to Read in double variables of length and width, using the keyboard A function to Calculate and return a double of the area of a rectangle A function to Print the length and width of the lot, the length and width of the house, area to be cut, and time to cut in minutes The application (main method) wants to know how much time to cut the grass of a rectangle lot with a rectangle house sitting in the middle of the lot. There are multiple sets of data, the last one has -1 -1 for the length and width. The algorithm is: 1, set variables of lengthHouse, widthHouse, lengthYard, widthYard, arealot, areaHouse, areaToCut, timeToCut 2 Set a constant of 2 seconds, called time, which is the time to cut 1 square foot of grass 3 call Read function to read lenth and with of yard 4 while (lengthYard ! = -1) 4.1 call Read function to read lenth and width of house 4.2 call Calculate function to calculate area of yard, returning value to areaLot 4.3 call Calculate function to calculate area of house, returning value to areaHouse 4.4 areaToCut = areaLot - areaHouse 4.5 timeToCut = areaToCut/time/60 4.7 call Print function 4.8 call Read function to read length and width of yard 5. Stop

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!