Question: Write a program that uses tagged C structs to present a list of term deposit options. 1. Open the source file named task3.c. Take note

 Write a program that uses tagged C structs to present alist of term deposit options. 1. Open the source file named task3.c.

Write a program that uses tagged C structs to present a list of term deposit options. 1. Open the source file named task3.c. Take note of the comments as they indicate where code should be placed for the remaining steps. 2. Add an extenal struct declaration with a tag name of account. The struct should have the same members as listed in Task 22. Recall from lectures that a tagged struct is one that includes a name hat can be used to refer to the struct type elsewhere in the program. The format is as follows: struct f :/INote the semicolon 3. As the table of term deposit rates contains six options, declare a preprocessor macro called NUM OPTIONS with a value (replacement text) of 6. Preprocessor macros use the directive define 4. Use the macro defined in the previous step for the size of the options array so it is no longer 1 5. In the previous task, you created a struct variable and then set the members underneath. An alternative approach is to create a function that acts like a constructor in Java and populates the members before returning a copy to the caller Complete the definition of the make account function so it uses the parameter values to create a new account struct. As the namespace of the struct members is separate from the parameters, the duplication of names presents no ambiguity issues 6. Make use of the make account function to add the remaining term deposit options to the array. Refer to the table at the bottom of this prac sheet 7. Finally, complete the definition of the prnt earnings function so it prints out each term deposit account option from the array (use your macro from step 3 to help) along with the interest eaned over a year for the amount (deposit) supplied. You should only calculate earnings for those accounts in which the minimum deposit requirement has been met. If it has not, the eanings are The formula for calculating the interest earned is: Rate x Deposit 8. Compile the program with make/gcc. A typical run should produce output similar to the following $ /task3 How much do you want to i 10500 This is how much you will earn in a yeari nvest? Institution Adelaide Bank Int. Rate in. deposit 5000 10000 5000 10000 5000 2.65 2-45 2.30 2.85 2.40 2.70 278.25 257.25 241.50 299.25 252.00 283.50 ING NAB s /task3 How nuch do you want to invest? This is how uch you will earn in a you Institution int. Rate Hin- deposit 5000 10000 5000 10000 5000 5000 Adelaide Bank 2.65 2.45 2.30 2.85 2.40 2.70 132.50 0.00 115.00 0.00 120.00 135.00 SAB

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!