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

The output 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 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("
//----------------------------------- // Test-2: return value only intA = intB = 0; printf("TEST-2: "); intA = getIntPositive(NULL); if (intA == TEST_INT) { printf("
//----------------------------------- // Test-3: argument only intA = intB = 0; printf("TEST-3: "); getIntPositive(&intA); if (intA == TEST_INT) { printf("
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("
//----------------------------------- // Test-2: return value only dblA = dblB = 0.0; printf("TEST-2: "); dblA = getDoublePositive(NULL); if (dblA == TEST_DBL) { printf("
//----------------------------------- // 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:
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
