Question: IPC144-workshop6-part2 c.source files. I have been an error, How can I fix it?'-' -> printf(Analysis Report (Note: Serving = %dg , ? ??); Thank you

IPC144-workshop6-part2 c.source files.

I have been an error, How can I fix it?'-' -> printf("Analysis Report (Note: Serving = %dg ", ???);

Thank you for answering!

/* ================================================== Workshop #6 (Part-2): ================================================== */

#define _CRT_SECURE_NO_WARNINGS // ---------------------------------------------------------------------------- // defines/macros #define MAX_PRODUCTS 3 #define MAX_GRAMS 64 #define CONVERSION_FACTOR_LBS_TO_KG 2.20462 // ---------------------------------------------------------------------------- // System Libraries struct ReportData { int pro_sku; double pro_price; int cal_per_s; double pro_wght_lbs; double pro_wght_kg; int pro_wght_gm; double total_serv; double cost_per_serv; double cost_cal_per_serv; }; // User-Defined Libraries struct CatFoodInfo { int sku_number; double product_price; int calories_per_serving; double product_weight; };

// ---------------------------------------------------------------------------- // PART-1

// 1. Get user input of int type and validate for a positive non-zero number // (return the number while also assigning it to the pointer argument) int getIntPositive(int* add);

// 2. Get user input of double type and validate for a positive non-zero number // (return the number while also assigning it to the pointer argument) double getDoublePositive(double* add1);

// 3. Opening Message (include the number of products that need entering) void openingMessage(const int nproducts);

// 4. Get user input for the details of cat food product struct CatFoodInfo getCatFoodInfo(const int seqno);

// 5. Display the formatted table header void displayCatFoodHeader(void) { printf("SKU $Price Bag-lbs Cal/Serv "); printf("------- ---------- ---------- -------- "); }

// 6. Display a formatted record of cat food data void displayCatFoodData(const int s_num, const double* pro_price, const int cal_ps, const double* pro_wght);

// ---------------------------------------------------------------------------- // PART-2

// 8. convert lbs: kg (divide by 2.20462) double convertLbsKg(const double* lbs_to_kg, double* kg_converted);

// 9. convert lbs: g (call convertKG, then * 1000) int convertLbsG(const double* lbs_conv, int* g_result);

// 10. convert lbs: kg and g void convertLbs(const double* lbs_con, double* kg_res, int* res);

// 11. calculate: servings based on gPerServ double calculateServings(const int ser_gm, const int total_gm, double* result);

// 12. calculate: cost per serving double calculateCostPerServing(const double* pro_pr, const double* serv, double* result);

// 13. calculate: cost per calorie double calculateCostPerCal(const double* pro_price, const double* total_cal, double* cal_res);

// 14. Derive a reporting detail record based on the cat food product data struct ReportData calculateReportData(const struct CatFoodInfo pro_data);

// 15. Display the formatted table header for the analysis results void displayReportHeader(void) { printf("Analysis Report (Note: Serving = %dg ", ???); printf("--------------- "); printf("SKU $Price Bag-lbs Bag-kg Bag-g Cal/Serv Servings $/Serv $/Cal "); printf("------- ---------- ---------- ---------- --------- -------- -------- ------- ------- "); }

// 16. Display the formatted data row in the analysis table void displayReportData(const struct ReportData display, const int cheap_pro);

// 17. Display the findings (cheapest) void displayFinalAnalysis(const struct CatFoodInfo data);

// ----------------------------------------------------------------------------

// 7. Logic entry point void start(void) {

}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!