Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

dev C++ Question 135 Marks You are given a CH program (Debug.cpp) with errors (syntax errors and/or logical errors, if any). The program has three

dev C++
image text in transcribed
image text in transcribed
image text in transcribed
Question 135 Marks You are given a CH program (Debug.cpp) with errors (syntax errors and/or logical errors, if any). The program has three (3) user-defined functions as listed below: Function Name getMenu getPrice Pas Description The function asks the users to enter a menu name and then return the menu name as a string pointer-type variable. The returned menu name is later assigned as an item of string pointer type array variable named menus The function accepts two arguments. The first argument is the caption text to guide users to enter the price or the pieces' number of chicken on the menu. The second argument is either the price of the piece of chickens which were represented by an array of integer pointer type variables: price and pos. The getPricePes function assigns data entered by the users to the corresponding item of these array variables The function accepts three arguments that are the menus, price, and pes parallel array pointer-type variables. It calculates the price for one piece of chicken on cach menu (price/pos) and then returns the index number of array items which representing the cheapest menu (menu with lowest price for one piece of chicken) cheapestMenu The main function of the program has a series of calls to getMenu and getPricePos functions inside a loop control structure. The menus, price, and pcs are parallel pointer type arrays 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 getMenu and getPricePcs functions). Some of the output was produced by a call made to cheapestMenu function. The last part of the output produced after the index number of parallel aay items representing the cheapest menu was returned by the cheapest Menu 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 outputs as in Figure 1. Note: The values in bold are input by the user 2 3 7/Debug.cpp Binelude > P data 2 ant cheapest Menu string **. in pr. spel float pes price, pes_price_lowess - 0 int 1dx cout > P data 2 ant cheapest Menu string **. in pr. spel float pes price, pes_price_lowess - 0 int 1dx cout

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Current Trends In Database Technology Edbt 2004 Workshops Edbt 2004 Workshops Phd Datax Pim P2panddb And Clustweb Heraklion Crete Greece March 2004 Revised Selected Papers Lncs 3268

Authors: Wolfgang Lindner ,Marco Mesiti ,Can Turker ,Yannis Tzitzikas ,Athena Vakali

2005th Edition

3540233059, 978-3540233053

More Books

Students also viewed these Databases questions

Question

Identify the elements that make up the employee reward package.

Answered: 1 week ago

Question

Understand the purpose, value and drawbacks of the interview.

Answered: 1 week ago