Lab3. For and While loops for C++ I've been stuck on this lab for some time now, I've asked my professor for help and I have gotten none from them. This is as far as i have gotten //-----------------...


Lab3. For and While loops for C++


I've been stuck on this lab for some time now, I've asked my professor for help and I have gotten none from them.


This is as far as i have gotten


//-------------------------------------GRADING BLOCK------------------------------------------------
//Programmer's Name: Your name HERE
//Program: Lab 3A
//Grade: NNN/50
//Professor's Comments:
//
//
//
//--------------------------------------------------------------------------------------------------
//
//-------------------------------------IPO BLOCK----------------------------------------------------
//Programmer's Name: Your name HERE
//Program: Lab 3
//Program Flow (IPO):
//Open the input & output files
//Output the divider to the screen
//Output file name messages to the screen
//Output the divider to the screen
//Set formatting to 2 decimals for floating point values on the screen
//Output the course heading to the output file
//Output the divider to the output file
//Move to the next line in the output file
//Output the column headings to the output file
//Output the divider to the output file
//Initialize the count of rooms
//Initialize the cost accumulators
// total carpet cost
// total tack cost
// total installation cost
// total cost of carpeting
//
//Input the room name from the input file
//while there is data in the input file:
// Input the length and width of a room from the input file
// Increment the count of rooms
// Calculate the area
// Calculate the perimeter
// Calculate the square yards
// Calculate the carpet cost
// Calculate the tack strip cost
// Calculate the installation charge
// Calculate the total cost of carpeting this room
// Accumulate the grand total costs
// Output the count of rooms, the room name, length & width to the output file
// Output the area, perimeter, & square yards of a room to the output file
// Output the carpet cost, the tack cost, the installation cost & the total cost of the carpeting
// to the output file
// Move the input to the next line in the input file
// Input the next room name from the input file
//End while
//
//Output the divider to the output file
//Output the grand totals to the output file
//Output the divider to the screen
//Close the input & output files
//--------------------------------------------------------------------------------------------------


#include
#include
#include
#include
using namespace std;
//Output to specified width


const int DIVIDER_WIDTH = 111;




//Constants
const string Divider = "*";
const string College = "Suny Broome";
const string Course = "CST 113 R01";
const string Programmer = "YOUR NAME";
const string Lab = "Lab 1";




int CarpetCostPerSquareYard = 15.49;
int TackStripCostPerFoot = 0.33;
int InstallationChargePerSquareYard = 4.25;


int main(void)
{
ifstream roomDataFile;
ofstream outFile;



int RoomArea;
int SquareYardsInARoom;
int RoomPerimeter;
double CarpetCostPerSquareYard{ 15.49 };
double TackStripCostPerFoot{ 0.33 };
double InstallationChargePerSquareYard{ 4.25 };
double TotalCost;
double TackCost;
double CarpetCost;
double InstallationCost;
double LengthOfRoom;
double WidthOfRoom;



string Room;
string Number;
string Length;
string Width;
string Area;
string Perimeter;
string Square;
string Yards;
string Carpet;
string Tack;
string Install;
string Total;
string Cost;
string livingRoom;
string roomData1;
string outputFile1;




//roomDataFile.open("roomData.txt");
//outFile.open("outFileData.txt");



//Set formatting to 2 decimals for floating point values on the screen
cout



cout

cout < "the="" inpit="" is="" from="" the="" file:="" "="">< endl;="" cin="">> roomData1;
cout < "the="" output="" is="" from="" the="" file:="" "="">< endl;="" cin="">> outputFile1;
cout



roomDataFile.open("roomData.txt");
outFile.open("outFileData.txt");



//Output the divider to the screen
cout

//Output the course heading to the screen
cout

cout

cout

cout

//Output the divider to the screen
cout

//Move the output pointer down 1 line on the screen
cout

//Output the column headings to the screen
cout





cout

//Output the divider to the screen
cout



getline(roomDataFile, livingRoom);



while (roomDataFile)
{
roomDataFile >> LengthOfRoom >> WidthOfRoom;



Area = LengthOfRoom * WidthOfRoom;
}



//Initialize the number of rooms


}

Dec 11, 2021
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions ยป

Submit New Assignment

Copy and Paste Your Assignment Here