Write a program in C as follows:- Create an array of integers named “toy” that has 120 rows and 4 columns.- The program should repeatedly display the following menu:A or a to add a toy to the bagV or v to calculate and display the total value of the toysW or w to calculate and display the total weight of the toysD or d to delete a toy from the arrayM or m to calculate and display the number of small toysN or n to calculate and display the number of medium toysL or l to calculate and display the number of large toysX or x to start filling a new bagP or p to exit programThe following functions need to be created and used in the program:- Void wipe(int cat[][4], int n);- Void populate(int cat[][4], int n);- Int size(int L, int W, int H);- Int check_capacity(int cat[][4], int n, int tsize, int tweight);- Int rm_toy(int cat[][4], int n, int toynum);- Int weight(int cat[][4], int n);- Int value(int cat[][4], int n);- Int small(int cat[][4], int n);- Int medium(int cat[][4], int n);- Int large(int cat[][4], int n);Functions:- The function wipe that will overwrite the array with zeros.- Populate function asks the user for the bag number, as a two digit number from 10 to 99, andpopulates the first column array with the individual toy numbers as the concatenation of thebag number and the numbers from 1 to 120.(e: if bag number is 12 then the toy numbers wouldbe 12001, 12002, 12003, 12004,..., 12119, 12120)- Size function takes three parameters in cm as the length width and height of a box and return aninteger as follows: 0 if any of the three dimensions is greater than 100 or less than 1 4 if any of the three dimensions is greater than 75 2 if any of the three dimensions is greater than 50 1 if any of the dimensions is greater than 0 an less than or equal 50- Check_capacity function will have four parameters, one of them is the weight of the toy, one ofthem is the value returned by the size function and will return a 0 if the array cannot add thespecific box, and 1 if it can be added (hint: you have to Check how many of each size box arepresent in the array and the total weight of the boxes to make the determination if a 0 or a 1is returned. The functions below can be used inside the check_capacity function as well.).- Rm_toy deletes a toy from the array if the argument passed to the parameter toynum matchesa toy number in the array. The function returns 1 if a match was found and deleted.- The weight function returns the total weight of the toys in the array.- The value function returns the total value of the toys in the array.- The small function returns the total number of small boxes.- The medium function returns the total number of medium boxes.               - The Large function returns the total number of large boxes.Menu options:- Option A: To add a toy to the bag, the user is asked for the length, width, height, and weight ofthe bag. The function size, check_capacity, and weight are called to determine if the box can beadded. If it can be added, then the user is asked for the value in dollars (no cents) and the nextavailable array location(row) will be populated with the size(as returned by the size function),weight, and value.- Option V: call the function value on the array and display the return total value in main.- Option W: call the function weight on the array and display the return total weight in main.- Option D: ask the user for a toy number, use the delete function to attempt toy deletion, outputa message in main stating weather deletion is successful or not.- Options M, N, and L are similar to V and W.- Option X: call function wipe and then ask the user for a bag number and pass as argument tofunction populate. Enter option X first every time you start the program too.- Option P: exit program

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

Write a program in C as follows:
- Create an array of integers named “toy” that has 120 rows and 4 columns.
- The program should repeatedly display the following menu:
A or a to add a toy to the bag
V or v to calculate and display the total value of the toys
W or w to calculate and display the total weight of the toys
D or d to delete a toy from the array
M or m to calculate and display the number of small toys
N or n to calculate and display the number of medium toys
L or l to calculate and display the number of large toys
X or x to start filling a new bag
P or p to exit program

The following functions need to be created and used in the program:
- Void wipe(int cat[][4], int n);
- Void populate(int cat[][4], int n);
- Int size(int L, int W, int H);
- Int check_capacity(int cat[][4], int n, int tsize, int tweight);
- Int rm_toy(int cat[][4], int n, int toynum);
- Int weight(int cat[][4], int n);
- Int value(int cat[][4], int n);
- Int small(int cat[][4], int n);
- Int medium(int cat[][4], int n);
- Int large(int cat[][4], int n);

Functions:
- The function wipe that will overwrite the array with zeros.
- Populate function asks the user for the bag number, as a two digit number from 10 to 99, and
populates the first column array with the individual toy numbers as the concatenation of the
bag number and the numbers from 1 to 120.(e: if bag number is 12 then the toy numbers would
be 12001, 12002, 12003, 12004,..., 12119, 12120)
- Size function takes three parameters in cm as the length width and height of a box and return an
integer as follows:
 0 if any of the three dimensions is greater than 100 or less than 1
 4 if any of the three dimensions is greater than 75
 2 if any of the three dimensions is greater than 50
 1 if any of the dimensions is greater than 0 an less than or equal 50
- Check_capacity function will have four parameters, one of them is the weight of the toy, one of
them is the value returned by the size function and will return a 0 if the array cannot add the
specific box, and 1 if it can be added (hint: you have to Check how many of each size box are
present in the array and the total weight of the boxes to make the determination if a 0 or a 1
is returned. The functions below can be used inside the check_capacity function as well.).
- Rm_toy deletes a toy from the array if the argument passed to the parameter toynum matches
a toy number in the array. The function returns 1 if a match was found and deleted.
- The weight function returns the total weight of the toys in the array.
- The value function returns the total value of the toys in the array.
- The small function returns the total number of small boxes.
- The medium function returns the total number of medium boxes.

 
 
 
 
 
 
 
- The Large function returns the total number of large boxes.
Menu options:
- Option A: To add a toy to the bag, the user is asked for the length, width, height, and weight of
the bag. The function size, check_capacity, and weight are called to determine if the box can be
added. If it can be added, then the user is asked for the value in dollars (no cents) and the next
available array location(row) will be populated with the size(as returned by the size function),
weight, and value.
- Option V: call the function value on the array and display the return total value in main.
- Option W: call the function weight on the array and display the return total weight in main.
- Option D: ask the user for a toy number, use the delete function to attempt toy deletion, output
a message in main stating weather deletion is successful or not.
- Options M, N, and L are similar to V and W.
- Option X: call function wipe and then ask the user for a bag number and pass as argument to
function populate. Enter option X first every time you start the program too.
- Option P: exit program
AI-Generated Solution
AI-generated content may present inaccurate or offensive content that does not represent bartleby’s views.
steps

Unlock instant AI solutions

Tap the button
to generate a solution

Knowledge Booster
Array
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education