//Compute how long it takes to Mow a Lawn on a Rectangular lot with // a Rectangular House, Given the Gardener Mows X Feet per Second // Output: Time in Hours, Minutes and Seconds // Input : Length and Width of the Entire Lot and the House #include #include // Find and Return the Area of a Rectangle to Nearest Foot Squared int Area(int,int); //Args: Length, Width //Compute Time to Mow to the Nearest Second int TimeToMow(int,int); // Args: Area, Feet Mowed Per Second // Output the Time to Mow in Hours, Minutes and Seconds void Report(int); // Arg: Time to Mow in Seconds // Main Routine void main() {int SquareFeetPerSecond, YardLength,YardWidth, HouseLength,HouseWidth, AreaToMow,Seconds; cout << "Enter Length and Width of Yard in Feet>"; cin >> YardLength >> YardWidth; cout << "Enter Length and Width of House in Feet>"; cin >> HouseLength >> HouseWidth; cout << "How Many Feet Per Second Does the Gardener Mow? >"; cin >> SquareFeetPerSecond; AreaToMow=Area(YardLength,YardWidth)-Area(HouseLength,HouseWidth); Seconds=TimeToMow(AreaToMow,SquareFeetPerSecond); Report(Seconds); } // Find the Area of a Rectangle int Area(int Length,int Width) {return(Length*Width);} // Compute Time Required as Square Feet Divided by Square Feet Per Second int TimeToMow(int Area,int Speed) {return(Area/Speed);} void Report(int Seconds) {int Hours,Minutes; const int SecondsPerMinute=60,MinutesPerHour=60; // Compute Minutes and Remaining Seconds Minutes=Seconds/SecondsPerMinute; Seconds=Seconds%SecondsPerMinute; // Compute Hours and Remaining Minutes Hours=Minutes/MinutesPerHour; Minutes=Minutes%MinutesPerHour; cout << "Time required is " << Hours << " Hours, " << Minutes << " Minutes and " << Seconds << " Seconds\n"; }