Question: this is task3> 1. Make a copy of your task3.c source file and name it task4a.c. 2 Open the files named task4b.h and task4b.c. 3.
this is task3>
1. Make a copy of your task3.c source file and name it task4a.c. 2 Open the files named task4b.h and task4b.c. 3. In task4a.. #include the task4b.h header 4. Migrate aspects of task4a to task4b: o Move the struct declaration to task4b.h o Move the two functions prototypes, make_account and print earnings, to task4b.h. Modify the signature of the print earnings function to match the following: void print earnings (float deposit, struct account options, int num); Move the definitions of make account and print earnings to task4b.c. Once again, modify the signature of the print earnings function to match the previous step. 5. Fix the print earnings function in task4b.c to work with its new parameters. You no longer have access to the options array or NUM OPTIONS macro so you will have to loop through account options via the pointer reference. 6. Modify the call to print earnings in the main function of task4a.c to pass in the options array and size (NUM_OPTIONS). 7. Write a makefile to compile task4a.c and task4b.c. Refer to the lecture slides for an example of a makefile for multiple source files. You do not need to explicity compile the task4b.h header file; it wil be compiled when one of the files it is included in is. Hint: You will need three rules: one to build the object files for task4a, one to build the object files for task4b, and one to link them together to form the final program: task4a.o: task4b.o:... 8. Compile your program with make. Verity the output is unchanged from Task 3. 1. Make a copy of your task3.c source file and name it task4a.c. 2 Open the files named task4b.h and task4b.c. 3. In task4a.. #include the task4b.h header 4. Migrate aspects of task4a to task4b: o Move the struct declaration to task4b.h o Move the two functions prototypes, make_account and print earnings, to task4b.h. Modify the signature of the print earnings function to match the following: void print earnings (float deposit, struct account options, int num); Move the definitions of make account and print earnings to task4b.c. Once again, modify the signature of the print earnings function to match the previous step. 5. Fix the print earnings function in task4b.c to work with its new parameters. You no longer have access to the options array or NUM OPTIONS macro so you will have to loop through account options via the pointer reference. 6. Modify the call to print earnings in the main function of task4a.c to pass in the options array and size (NUM_OPTIONS). 7. Write a makefile to compile task4a.c and task4b.c. Refer to the lecture slides for an example of a makefile for multiple source files. You do not need to explicity compile the task4b.h header file; it wil be compiled when one of the files it is included in is. Hint: You will need three rules: one to build the object files for task4a, one to build the object files for task4b, and one to link them together to form the final program: task4a.o: task4b.o:... 8. Compile your program with make. Verity the output is unchanged from Task 3
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
