Question: I want the reflection part for this 2 questions please The output of this program reflection is here Actually I did not have the right

I want the reflection part for this 2 questions please

I want the reflection part for this 2 questions please The output

The output of this program reflection is here

of this program reflection is here Actually I did not have the

right code for this program , but i will provide yout the

main code idea, and the output for this program already i attached

Actually I did not have the right code for this program , but i will provide yout the main code idea, and the output for this program already i attached it /* ================================================== Workshop #6 (Part-2): ================================================== +------------------------------------------------+ IMPORTANT ========= *** DO NOT MODIFY THIS FILE *** +------------------------------------------------+ */

#include

#include "w6p2.h"

#define TEST_NEG -1 #define TEST_ZERO 0 #define TEST_INT 24 #define TEST_DBL 82.5 #define TEST_LBSKG 2.20462 #define TEST_LBSG 2494 #define TEST_LBS 5.5

// --------------------------------------- // Function prototypes // --------------------------------------- int testIntFunction(void); int testDoubleFunction(void); int testConvertLbsKg(void); int testConvertLbsG(void); int testConvertLbs(void);

// --------------------------------------- // Main entry-point to the program // --------------------------------------- int main(void) { int preTestFailed = 0;

printf("============================ "); printf("Pre-testing Helper Functions "); printf("============================ ");

preTestFailed += testIntFunction(); preTestFailed += testDoubleFunction(); preTestFailed += testConvertLbsKg(); preTestFailed += testConvertLbsG(); preTestFailed += testConvertLbs();

if (preTestFailed) { printf("XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX "); printf(" Pretesting revealed ERRORS in the helper functions. "); printf(" Review where the tests failed and fix these errors "); printf(" before continuing. "); printf("XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX "); } else { printf("=========================== "); printf("Starting Main Program Logic "); printf("=========================== ");

// Entry-point to program logic start(); }

return 0; }

// --------------------------------------- // Function definitions // ---------------------------------------

int testIntFunction(void) { int intA = 0, intB = 0, fail = 0;

printf("------------------------ "); printf("Function: getIntPositive "); printf("------------------------ "); printf("For each of these tests, enter the following "); printf("three values (space delimited): %d %d %d ", TEST_NEG, TEST_ZERO, TEST_INT);

//----------------------------------- // Test-1: argument and return value printf("TEST-1: "); intB = getIntPositive(&intA); if (intA == intB && intA == TEST_INT) { printf(" "); } else { printf(" "); fail++; }

//----------------------------------- // Test-2: return value only intA = intB = 0; printf("TEST-2: "); intA = getIntPositive(NULL); if (intA == TEST_INT) { printf(" "); } else { printf(" "); fail++; }

//----------------------------------- // Test-3: argument only intA = intB = 0; printf("TEST-3: "); getIntPositive(&intA); if (intA == TEST_INT) { printf(" "); } else { printf(" "); fail++; }

return fail; }

int testDoubleFunction(void) { double dblA = 0.0, dblB = 0.0; int fail = 0;

printf("--------------------------- "); printf("Function: getDoublePositive "); printf("--------------------------- "); printf("For each of these tests, enter the following "); printf("three values (space delimited): %d %d %.1lf ", TEST_NEG, TEST_ZERO, TEST_DBL);

//----------------------------------- // Test-1: argument and return value printf("TEST-1: "); dblB = getDoublePositive(&dblA); if (dblA == dblB && dblA == TEST_DBL) { printf(" "); } else { printf(" "); fail++; }

//----------------------------------- // Test-2: return value only dblA = dblB = 0.0; printf("TEST-2: "); dblA = getDoublePositive(NULL); if (dblA == TEST_DBL) { printf(" "); } else { printf(" "); fail++; }

//----------------------------------- // Test-3: argument only dblA = dblB = 0.0; printf("TEST-3: "); getDoublePos

Record your answer in the reflect.txt file for each of the following: 1. Structures data types can demand a lot of memory (for example the "ReportData" structure). Without digging into advanced memory management (for example padding), how many bytes of memory would the "ReportData" structure require? How could we improve the passing of this information to functions? Use the function "displayReportData" from this workshop in your explanation 2. The CatFoodinfo structure and the Report Data structure contain common members. How could the "ReportData" structure be improved? Show the new and improved "ReportData" structure with your changes, then show how you would modify your code in the function "displayReportData". Specifically, show how you would need to modify the printf statement that displays the data. T070 Pre-testing Helper Functions Function: get IntPositive For each of these tests, enter the following three values (space delimited): -1 0 24 TEST-1; -10 24 ERROR: Enter a positive value: ERROR: Enter a positive value: TEST-2: -10 24 ERROR: Enter a positive value: ERROR: Enter a positive value: TEST-3: -1 @ 24 ERROR: Enter a positive value: ERROR: Enter a positive value: Function: getDoublePositive For each of these tests, enter the following three values (space delimited): -1 82.5 ho TEST-1:-1 @ 82.5 ERROR: Enter a positive value: ERROR: Enter a positive value: TEST-2: -1 0 82.5 ERROR: Enter a positive value: ERROR: Enter a positive value: TEST-3: -1 0 82.5 ERROR: Enter a positive value: ERROR: Enter a positive value: Function: convertibskg Test-1: Test-2: Test-3: Function: convertLbs Test-1: Starting Main Program Logic Cat Food Cost Analysis Enter the details for 3 dry food bags of product data for analysis. NOTE: A 'serving' is 64g Cat Food Product #1 SKU ERROR: Enter a positive value: 12221 PRICE : $0 ERROR: Enter a positive value: 26.99 WEIGHT (LBS) : ERROR: Enter a positive value: 2.5 CALORIES/SERV.: 0 ERROR: Enter a positive value: 325 Cat Food Product #2 SKU 34443 PRICE : $71.99 WEIGHT (LBS) 13.6 CALORIES/SERV.: 325 Cat Food Product #3 SKU PRICE WEIGHT (LBS) 23332 $41.99 5.5 CALORIES/SERV.: 325 SKU $Price Bag-lbs Cal/Serv 0012221 0034443 0023332 26.99 71.99 41.99 2.5 13.0 5.5 325 325 325 Analysis Report (Note: Serving = 64g) SKU $Price Bag-lbs Bag-kg Bag-g Cal/Serv Servings $/Serv $/Cal 0012221 0034443 0023332 26.99 71.99 41.99 2.5 13.0 5.5 1.1340 5.8967 2.4948 1133 5896 2494 325 325 325 17.7 92.1 39.0 1.52 0.00469 0.78 0.00240 *** 1.08 0.00332 Final Analysis Based on the comparison data, the PURRR-fect economical option is: SKU: 0034443 Price: $71.99 Happy shopping! Record your answer in the reflect.txt file for each of the following: 1. Structures data types can demand a lot of memory (for example the "ReportData" structure). Without digging into advanced memory management (for example padding), how many bytes of memory would the "ReportData" structure require? How could we improve the passing of this information to functions? Use the function "displayReportData" from this workshop in your explanation 2. The CatFoodinfo structure and the Report Data structure contain common members. How could the "ReportData" structure be improved? Show the new and improved "ReportData" structure with your changes, then show how you would modify your code in the function "displayReportData". Specifically, show how you would need to modify the printf statement that displays the data. T070 Pre-testing Helper Functions Function: get IntPositive For each of these tests, enter the following three values (space delimited): -1 0 24 TEST-1; -10 24 ERROR: Enter a positive value: ERROR: Enter a positive value: TEST-2: -10 24 ERROR: Enter a positive value: ERROR: Enter a positive value: TEST-3: -1 @ 24 ERROR: Enter a positive value: ERROR: Enter a positive value: Function: getDoublePositive For each of these tests, enter the following three values (space delimited): -1 82.5 ho TEST-1:-1 @ 82.5 ERROR: Enter a positive value: ERROR: Enter a positive value: TEST-2: -1 0 82.5 ERROR: Enter a positive value: ERROR: Enter a positive value: TEST-3: -1 0 82.5 ERROR: Enter a positive value: ERROR: Enter a positive value: Function: convertibskg Test-1: Test-2: Test-3: Function: convertLbs Test-1: Starting Main Program Logic Cat Food Cost Analysis Enter the details for 3 dry food bags of product data for analysis. NOTE: A 'serving' is 64g Cat Food Product #1 SKU ERROR: Enter a positive value: 12221 PRICE : $0 ERROR: Enter a positive value: 26.99 WEIGHT (LBS) : ERROR: Enter a positive value: 2.5 CALORIES/SERV.: 0 ERROR: Enter a positive value: 325 Cat Food Product #2 SKU 34443 PRICE : $71.99 WEIGHT (LBS) 13.6 CALORIES/SERV.: 325 Cat Food Product #3 SKU PRICE WEIGHT (LBS) 23332 $41.99 5.5 CALORIES/SERV.: 325 SKU $Price Bag-lbs Cal/Serv 0012221 0034443 0023332 26.99 71.99 41.99 2.5 13.0 5.5 325 325 325 Analysis Report (Note: Serving = 64g) SKU $Price Bag-lbs Bag-kg Bag-g Cal/Serv Servings $/Serv $/Cal 0012221 0034443 0023332 26.99 71.99 41.99 2.5 13.0 5.5 1.1340 5.8967 2.4948 1133 5896 2494 325 325 325 17.7 92.1 39.0 1.52 0.00469 0.78 0.00240 *** 1.08 0.00332 Final Analysis Based on the comparison data, the PURRR-fect economical option is: SKU: 0034443 Price: $71.99 Happy shopping

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 Databases Questions!