//******************************************************************** // Program to calculate the cost to mow a lawn -- lawn.cc // // Written by : Rex Forsyth // Date : Feb 1, 2007 // Sample program for CS1620 Spring 2007 // // This version has all the errors removed //******************************************************************** #include #include using namespace std; const double SQR_METRE_COST = 0.55; int main() { double yardWidth, yardLength; double houseWidth, houseLength; double lawnArea; string name; cout << "Enter your name -- "; getline(cin,name); cout << "Enter the length and width of the yard in metres: "; cin >> yardLength >> yardWidth; cout << "Enter the length and width of the house in metres: "; cin >> houseLength >> houseWidth; lawnArea = yardLength*yardWidth - houseLength*houseWidth; double cost = lawnArea * SQR_METRE_COST; double weekendCost = cost + (1.0/3)*cost; cout << "The cost to mow " << name << "'s lawn during the week is $" << cost << endl; cout << "The cost to mow " << name << "'s lawn on the weekend is $" << weekendCost << endl; return 0; }