Answered step by step
Verified Expert Solution
Link Copied!

Question

00
1 Approved Answer

Please help. PLEASE DO NOT COPY FROM CHEGG AND PASTE HERE THEIR ANSWER DIDN'T FOLLOW THE DIRECTIONS IN THE ASSIGNMENT. HERE IS THE DRIVER CODE

Please help. PLEASE DO NOT COPY FROM CHEGG AND PASTE HERE THEIR ANSWER DIDN'T FOLLOW THE DIRECTIONS IN THE ASSIGNMENT.

image text in transcribed

image text in transcribed

HERE IS THE DRIVER CODE BELOW :

#ifdef INSTRUCTOR_FILE

#include

void RecordOpinions(void);

int main(void) { RecordOpinions(); return EXIT_SUCCESS; } #endif

Exclude any existing source code files that may already be in your IDE project and add a new one, naming it C2A3E3_RecordOpinions.c. Also add instructor-supplied source code file C2A3E3_main-Driver.c. Do not write a main function! main already exists in the instructor-supplied file and it will use the code you write. File C2A3E3_RecordOpinions.c must contain a function named Recordopinions that has no parameters and a void return. It must implement a survey of how shoppers like a product by prompting them to enter a decimal integer rating value within an allowed range of BEST to WORST. If any shopper enters a specified termination value the function must display a table of survey results and then return. Define the following four macros to have any integer values within the stated constraints and use them appropriately in your code, but your code must also work with any other integer values within those constraints. Although defining additional macros is unnecessary. you may do so as long as it is not necessary to explicitly change their values if the values of any of the required macros are changed: BEST - highest allowed rating value ( any value >=0 ) WORST - lowest allowed rating value [ always equal to -BEST ] The value of wORST must be derived from BEST and not specified as a literal number. CHOICES - the number of integer values from BEST down to wORST For example, if BEST is 3, the value of CHOICES will be 7. The value of choices must be derived from BEST and not specified as a literal number. TERMINATE - any value outside the range of allowed rating values. Recordopinions must: 1. Use a one-dimensional automatic type int array having exactly chorces elements. No other arrays are permitted. Each element represents an allowed rating and will contain a count of how many of that rating have been entered so far (similar to note 6.3). 2. Initially output a message that indicates the allowed rating range and the TERMINATE value. Then loop to individually prompt shoppers to enter their ratings. - If "end of file" is encountered or the rating represented by TERMINATE is entered, notify the shopper and go to step 3 below. - If an out-of-range rating other than that represented by TERMINATE is entered, notify and reprompt the shopper. - If an in-range rating is entered, increment the array element that represents that rating and prompt the next shopper. All array accesses must use the syntax pl. where p represents a variable that points to the array's middle element and i represents the rating the shopper entered. 3. Return from Recordopinions after first displaying a table like that below. The table must list all allowed rating values in the "Rating" column and the number of each that shoppers entered in the "Quantity" column. Entries must be in worst to best rating order and the least significant digits of all values must be aligned. A BEST value of 2 was used in this example: - If you believe you need more than one array or an array having other than CHOICES elements, you have not understood the requirements and should reread them as well as note 6.3. - Do not test if the values of the required macros are valid. - Do not use a loop to initialize your array to os or call a function to do it. - Do not produce the absolute value of anything. Manually re-run your program several times using various BEST and TERMINATE values and input ratings. Then test by specifying BEST and TERMINATE values of 5 and 999 , respectively, and redirecting input from instructor-supplied data file TestFile6.txt. That file must be placed in the program's "working directory". To test with different macro values you will need to recompile after each change

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered Solutions

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

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

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

Get Started

Students also viewed these Databases questions

Question

please dont use chat gpt 4 5 4 .

Answered: 1 week ago