Write a C++ program that reads and processes a carpenter’sfile homework_2.dat .
ID: 3617152 • Letter: W
Question
Write a C++ program that reads and processes a carpenter’sfile homework_2.dat. Each record (line)of the file contains an order number (nine digits), desk length ininches, desk width in inches, type of wood (‘P’ forpine, ‘O’ for oak, and ‘M’ for mahogany),and the number of drawers. One record exists for each customer.
Your program is to read the input file and produce a pricereport written to an output file (you choose its location andname). The report shall display a line for each order, and eachline shall contain the order number, base price, price for surfacearea, charge for type of wood to include the name (not the code) ofthe wood, the charge for drawers, and the total price for the desk.Compute the price using the following legend:
Base price = $200.
Surface area (length multiplied by width) over 750, add $50.
Pine = No extra charge
Oak = Add $125
Mahogany = Add $150
Drawers: Add $30 each.
Display at the bottom of the report the total number of workorders and the total price of all desks to be built.
Use a separate function to calculate the price of each desk.
Explanation / Answer
please rate - thanks sorry so late, don't know how I missed it #include #include using namespace std; int getcost(int,int,int,char); int main() {int order,length,width,drawers,area,orders=0,cost,total=0; char type; ifstream in; ofstream out; in.open("homework2.dat"); if(in.fail()) { coutwidth>>type>>drawers; cost=getcost(length,width,drawers,type); total+=cost; outRelated Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.