Question: You are given a CH+ program (Final01.cpp) with errors (syntax errors and/or logical errors, if any). The program has three (3) user-defined functions as listed

 You are given a CH+ program (Final01.cpp) with errors (syntax errorsand/or logical errors, if any). The program has three (3) user-defined functions

You are given a CH+ program (Final01.cpp) with errors (syntax errors and/or logical errors, if any). The program has three (3) user-defined functions as listed in Table 1. Table 1: Description of functions Function Name Description getType The function asks the users to enter business type and then return the entered data as a string pointer-type variable. The returned business type is later assigned as an item of string pointer type array variable named types. setBusinessData The function accepts two arguments. The first argument is the caption text to guide users to enter the capital or the sale of the business. The second argument is either the capital or the sale data represented by an array of integer pointer type variables: capital and sale. The setBusinessData function assigns data entered by the users to the corresponding item of these array variables. highest Profit The function accepts three arguments that are the types, capital and sale parallel array pointer-type variables. It calculates the profit's percent over the capital for each business type. For example, delivery profit percent was calculated as: (450 - 300)/300 * 100. The function also returns the index number of array items which representing the highest profit percent of business. The main function of the program has a series of calls to getType and setBusinessData functions inside a loop control structure. The types, capital, and sale are parallel array pointer type with references to their item's index was made based on variable used to control the loop (loop which used to make a series of call to getType and setBusinessData functions). Some of the output was produced by a call made to highestProfit function. The last part of the output produced after the index number of parallel array items representing the cheapest menu was returned by the highestProfit function. You are required to debug the errors, compile, and run the program. You are NOT ALLOWED to remove any statements in the program. You are only allowed to update the statements provided in the program and add a new statement(s) if absolutely necessary. The program should produce the output as in Figure 1. Note: The values in bold are input by the user. set BusinessData("Sale (RM): sale[1]); cout int idx_hp_profit = highest Profit (types, capital, sale, hp_profit); 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 cout int idx_hp_profit = highest Profit (types, capital, sale, hp_profit); 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 cout

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!