int selectCarpet ( ); // selectCarpet() displays a menu option of carpets, // ge
ID: 3617365 • Letter: I
Question
int selectCarpet ( ); // selectCarpet() displays a menu option of carpets,
// get user selection, and returns to its caller;
#include
using
const
MEDIUM = 4.59,
BASIC = 3.50,
INSTALL = 129.99;
const
int
{
ftWidth,
ftSq,
ydSq,
materialCost,
totalCost,
grandTotal,
unitPrice;
type,
count,
numRooms;
{
cout <<
cout <<
<<
<<
<<
<<
<<
cin >> type;
}
{
cout <<
cin >> numRooms;
grandTotal = 0;
{
cout <<
cin >> ftLength;
cout <<
cin >> ftWidth;
ftSq = ftLength * ftWidth;
Explanation / Answer
please rate - thanks I also corrected the spelling of the word width in your code #include #include #include using namespace std; int selectCarpet ( ); // selectCarpet()displays a menu option of carpets, // get user selection, and returns to its caller; // user selection must be valid menu option void selectCarpet(int&); const double BEST = 6.99, MEDIUM = 4.59, BASIC = 3.50, INSTALL = 129.99; const int NINE = 9; int main() { double ftLength, // room length in feet ftWidth, // room width in feet ftSq, // square footage ydSq, // square yard materialCost, // carpet material cost totalCost, // material cost plus install grandTotal, unitPrice; int squareYd, // square yards, round off type, // carpet type count, numRooms; // step 1 do {type=selectCarpet(); }while(type != 1 && type != 2 && type != 3&& type != 4); while( type != 4 ) { // step 2 if(type == 1) unitPrice = BEST; else if (type == 2) unitPrice = MEDIUM; else if (type == 3) unitPrice = BASIC; // step 3 cout > numRooms; grandTotal = 0; for( count = 0; count ftLength; cout > ftWidth; // step 5 ftSq = ftLength * ftWidth; // step 6 ydSq = ftSq / NINE; // step 7 squareYd = int(ydSq + .5); // step 8 materialCost = squareYd * unitPrice; // step 9 totalCost = materialCost + INSTALL; // step 10 coutRelated Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.