1. Engineering
  2. Computer Science
  3. help c design a program for determining how much a...

Question: help c design a program for determining how much a...

Question details

Help C++

Design a program for determining how much a fence will cost based on the size of a residents back yard. Luckily, every resident has a square backyard with side lengths of at least 6 feet. Unfortunately, there is a local zoning requirement that all fences must be exactly 2 feet inside the perimeter of a backyard. The local fence construction company will charge 10 dollars per foot of fence.

Based on the description above design a program that will take the length of a side of a residents backyard (in feet) as in input and then output the amount of dollars that such a fence will cost

. --Note-- You will not be required to write any cout statements asking the user for input. You will simply write the code and place your input(s) into the "Enter program input (optional)" text box recalling that multiple inputs are separated by a space

#include <iostream>
using namespace std;

int main()
{
cout << " Enter side of fence: " << endl;
float side;
float perimeter;
float cost;
cin>>side;
perimeter = side * 4;
cost = perimeter * 10;
cout << "\n For side of " << side << "feet, length of fence is " << perimeter << "feet" ;
cout<< "\n Cost of fencing = " << cost <<" dollars";
return 0;
}

Solution by an expert tutor
Blurred Solution
This question has been solved
Subscribe to see this solution