Question: Write a C program to keep track of the electronic devices manufactured by the BOZE manufacturing company. The information on each device consists of an

Write a C program to keep track of the electronic devices manufactured by the BOZE manufacturing company. The information on each device consists of an item code (Ex: B111) and a unit price. Assume that there are up to 20 different devices manufactured by this company.

Program Details:

Named Constant:Declare size of the array, 20 as a named constant.

Structure:Declare an abstract data type (struct) with global scope:

typedef struct

{

char device_code[10];

float device_price;

} Device_Record;

Required function:

1)display_array()

a.Input Parameters: Array of struct and number of entries in the array.

b.Output: void.

c.Task: display all the devices stored in the array in tabular format. Provide column headers.

2)average_unit_price()

Input Parameters: Array of struct and number of entries in the array.

Output: float.

Task: Compute the average unit price and return it as output.

int main()

{

Declare an array ofstructto store up to 20 devices (use the named constant). Declare other variables as needed.

Write a loop topartiallyfill the array in a loop.

oPrompt the user to enter the code, read it into a local char array.

Use XXX as a sentinel value to end the data entry and exit the loop

Tip: Usestrcmpfunction to compare the device name to XXX

oPrompt the user to enter the unit_price,

oStore the entered data in the array at proper index.

After the loop, display the number of entries in the array.

Invokedisplay_array( )to display all the devices stored in the array to the screen.

Invokeaverage_unit_price( )to compute the average unit price. Display the average with 2 digits after the decimal pointin the main function.

Use sequential search algorithm to display all the devices with unit price below $40.00. Inform the user if the search fails.

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 Programming Questions!