Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Table 7-7 7 46. Using an editor, create an inventory file using the data shown i

ID: 3741276 • Letter: T

Question

Table 7-7 7 46. Using an editor, create an inventory file using the data shown in T do not include the column captions, just the data). Part No. Price Quantity On Reorder Minimum Point 20 50 50 10 75 Order 20 25 10 Hand 1.23 2.34 34.56 45.67 6.78 23 34 56 7 75 0123 0234 3456 4567 5678 25 TABLE 7-7 Inventory file data for Project 46 Write a program to read the inventory file and create an inventory report. The report will contain the part number, price, quantity on hand, reorder minimum order, and order amount. The order amount is calcu- lated when the quantity on hand falls below the reorder point. It is calcu- lated as the sum of the reorder point and the minimum order less the quantity on hand. Provide a report heading, such as "Inventory Report, e at the end of the report. Print the part number with leading zeros. 47. Using an edit

Explanation / Answer

make a inventory file as with given datas: ------------>>>>>>>>

0123 1.23 23 20 20
4567 45.67 7 10 5

here is your program : ------------->>>>>>>>>>>>

#include<iostream>
#include<fstream>

using namespace std;

struct parts{
int number;
int QOH;
int RePoint;
int MPoint;
double price;
};

int numberOfEntry(ifstream &ifs){
int n = 0;
string line;
getline(ifs,line);
while(!ifs.eof()){
  n++;
  getline(ifs,line);
}

return n;
}

void readFile(parts **inventory,int &n){
string file;
cout<<" Enter the Inventory File Name : ";
cin>>file;
ifstream ifs;
ifs.open(file.c_str());
if(ifs.is_open()){
  n = numberOfEntry(ifs);
  ifs.clear();
  ifs.seekg(0,ios::beg);
  (*inventory) = new parts[n];
  for(int i = 0;i<n;i++){
   ifs>>(*inventory)[i].number;
   ifs>>(*inventory)[i].price;
   ifs>>(*inventory)[i].QOH;
   ifs>>(*inventory)[i].RePoint;
   ifs>>(*inventory)[i].MPoint;
  }
  
  ifs.close();
}else{
  cout<<" File opening error check input file ";
  exit(0);
}
}

void printReport(parts *inventory,int s){
system("cls");
cout<<"--------------------------------------   Inventory Report -------------------------------------- ";
cout<<" Part No.       Price      QOH         Re-Point         Minimum Order          Order Amount     ";
for(int i = 0;i<s;i++){
  printf("%04d           ",inventory[i].number);
  printf("%0.2lf        ",inventory[i].price);
  printf("%02d          ",inventory[i].QOH);
  printf("%02d               ",inventory[i].RePoint);
  printf("%02d                     ",inventory[i].MPoint);
  if(inventory[i].QOH < inventory[i].RePoint){
   printf("%02d    ",(inventory[i].RePoint+inventory[i].RePoint)-inventory[i].QOH);
  }else{
   cout<<"None";
  }
  cout<<endl;
}
}

int main(){
parts *inventory;
int size = 0;
readFile(&inventory,size);
printReport(inventory,size);

return 0;
}