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 of struct to store up to 20 devices (use the named constant). Declare other variables as needed.

Write a loop to partially fill the array in a loop.

o Prompt 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: Use strcmpfunction to compare the device name to XXX

o Prompt the user to enter the unit_price,

o Store the entered data in the array at proper index.

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

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

Invoke average_unit_price( ) to compute the average unit price. Display the average with 2 digits after the decimal point in 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.

 Write a C program to keep track of the electronic devices

Assignment-09 Output Enter the code for the next device: B121 Enter the unit price: 34 Enter the code for the next device: B200 Enter the unit price: 56 Enter the code for Lhe next device 8312 Enter the unit price: 25 Enter the o for the next device: B300 Enter the ut price: 60.90 Enter the e for the next device: B412 Enter the t price: Enter the e-e for the next device: xxx The number of devices ontered 5 29.90 Code Price B121 B200 B312 300 B412 4.00 6.00 5.00 O.90 9. 90 Auer ag price 1 .16 Devices under $4O. 00 B121 8312 5.00 .90 B412

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!