I was wondering if someone can help me with my project.
I need help with the order amount. I was going to use a if else statement, but I'm not sure how to start it.
Project information:
Write a program that reads a file and create a report. The report will contain the part number,
price, quantity on hand, reorder point, minimum order, and order amount.
The order amount is calculated when the quantity on hand falls below reorder point.
It is calculated as the sum of the reorder point and the minimum order less the quantity on hand.
Provide a report heading, captions for each column, and an end of report message at the end of the report.
Print the part number with leading zeros.
My code:
#include "stdafx.h"
#include "stdlib.h"
int main(void)
{
FILE* sp1;
int num;
int quantity;
int point;
int order;
float price;
sp1 = fopen("c:\\inventory.txt", "r");
if (!sp1)
{
printf("Error: Can't open file\a\n");
exit (101);
}
printf(" Inventory Report \n");
printf("================================================================\n");
printf("Part No. Price Quantity Reorder Point Min Order Order Amount\n\n");
while((fscanf(sp1,"%4d%5f%2d%2d%2d",&num, &price, &quantity, &point, &order)) ==5)
{
printf("%04d %2.2f %2d %2d %2d\n",num, price, quantity, point, order);
}
printf("=================================================================\n\n\n");
printf(" End of Report \n");
return 0;
}