Question: A session with the program: Enter operation code: i Enter part number: 5 2 8 Enter part name: Disk drive Enter quantity on hand: 1

A session with the program:
Enter operation code: i
Enter part number: 528
Enter part name: Disk drive
Enter quantity on hand: 10
Enter operation code: s
Enter part number: 528
Part name: Disk drive
Quantity on hand: 10
Enter operation code: s
Enter part number: 914
Part not found.
Enter operation code: i
Enter part number: 914
Enter part name: Printer cable
Enter quantity on hand: 5
Enter operation code: u
Enter part number: 528
Enter change in quantity on hand: -2
Enter operation code: s
Enter part number: 528
Part name: Disk drive
Quantity on hand: 8
Enter operation code: p
Part Number Part Name Quantity on Hand
528 Disk drive8
914 Printer cable5
Enter operation code: q
Steps:
The program will store information about each part in a structure.
The structures will be stored in an array (global) named inventory.
A global variable named num_parts will keep track of the number of parts currently stored in the array.
An outline of the programs main loop:
for (;;){
prompt user to enter operation code;
read code;
switch (code){
case 'i': perform insert operation; break;
case 's': perform search operation; break;
case 'u': perform update operation; break;
case 'p': perform print operation; break;
case 'q': terminate program;
default: print error message;
}
}

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!