Database System Concepts
Database System Concepts
7th Edition
ISBN: 9780078022159
Author: Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher: McGraw-Hill Education
expand_more
expand_more
format_list_bulleted
Bartleby Related Questions Icon
Related questions
Question
Transcribed Image Text:complete program that manages the library inventory of a bookstore with o
different book titles. The program should:
(i) Prompt the user to input the quantity of each book in stock.
Apply a 2D array to store the quantities.
(ii) Identify which book has the highest stock quantity.
Apply a non-return value function, include a parameter list if necessary.
(iii) Identify which book has the lowest stock quantity.
Apply a non-return value function, include a parameter list if necessary.
(iv) Calculate the average stock quantity for all books and display it.
Apply a return value function, include a parameter list if necessary.
(v) Determine whether each book is well-stocked or needs restocking by comparing
its quantity to the average stock quantity. If a book's quantity is greater than or equal
to the average, then it's well-stocked; otherwise, it needs restocking.
Requirements:
Apply a 2D array.
Use functions for better modularization.
Display the results clearly for each book.
Sample Output:
Enter quantities for -
Book 1:50
Book 2: 80
Book 3: 120
Book 4: 40
Book 5: 90
Book 6: 60
Highest Stock: Book 3 [120 units]
Lowest Stock: Book 4 [40 units]
Average Stock: 75.00 units
Book 1: Needs restocking
Book 2: Well-stocked
Book 3: Well-stocked
Book 4: Needs restocking
Book 5: Well-stocked
Book 6: Well-stocked.
Expert Solution
Check MarkThis question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
bartleby
Step by stepSolved in 3 steps with 2 images
Knowledge Booster
Background pattern image
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
- Develop program to read as many test scores as the user wants from the keyboard (assuming at most 50 scores). Print the scores in (1) original order, (2) sorted from high to low (3) the highest score, (4) the lowest score, and (5) the average of the scores. Implement the following functions using the given function prototypes: void displayArray(int array[], int size) - Displays the content of the array void selectionSort(int array[], int size) - sorts the array using the selection sort algorithm in descending order. Hint: refer to example 8-5 in the textbook. int findMax(int array[], int size) - finds and returns the highest element of the array int findMin(int array[], int size) - finds and returns the lowest element of the array double findAvg(int array[], int size) - finds and returns the average of the elements of the array Name your file FirstInitialLastName_CW_8. cpp Submit: Submit flowchart/Algorithm/Pseudocode C++ file (source code): FirstInitialLastName_CW_8....arrow_forwarddesign the program to hold 30 employees (therefore 30 member array of struct). The data file may have more than 30 employee records however. In that case your program must read only 30 records and give a message that number of records exceeded the program capacity. If data file is empty, then program must print the message to inform user that data file is empty. Modularize your program with functions as much as you can. Your program output must be of the following format. check this Job Type Management Gross Salary 2205ドル.00 Name ID# Jack Smith 1234 number for аccuracy For employees, for which the data are bad, the program must print the message to the affect that Gross Salary could not be calculated due to bad data. The types of bad data may be: Employee code in lower case letter Number of years of service exceeding 50 years Educational and job classification code not in the correct range. The output must be printed to a file. The output file must have processed data printed in the...arrow_forwardWrite a C++ program to declare an array A={3, -7, 12, -4, 5, -2} and pass it to a void-type function findMaxMinAvg (array) that prints out the maximum, minimum and average values in the array. Your answerarrow_forward
- I need help solving this in PYTHONarrow_forwardCan you help me write the code for this MATLAB assignment?arrow_forwardAdd a function to get the CPI values from the user and validate that they are greater than 0. 1. Declare and implement a void function called getCPIValues that takes two float reference parameters for the old_cpi and new_cpi. 2. Move the code that reads in the old_cpi and new_cpi into this function. 3. Add a do-while loop that validates the input, making sure that the old_cpi and new_cpi are valid values. + if there is an input error, print "Error: CPI values must be greater than 0." and try to get data again. 4. Replace the code that was moved with a call to this new function. - Add an array to accumulate the computed inflation rates 1. Declare a constant called MAX_RATES and set it to 20. 2. Declare an array of double values having size MAX_RATES that will be used to accumulate the computed inflation rates. 3. Add code to main that inserts the computed inflation rate into the next position in the array. 4. Be careful to make sure the program does not overflow the array. - Add a...arrow_forward
- In C++ please and thank you!arrow_forwardin the C++ version please suppose to have a score corresponding with probabilities at the end and do not use the count[] function. Please explain the detail when coding. DO NOT USE ARRAY. The game of Pig The game of Pig is a dice game with simple rules: Two players race to reach 100 points. Each turn, a player repeatedly rolls a die until either a 1 ("pig") is rolled or the player holds and scores the sum of the rolls (i.e. the turn total). At any time during a player's turn, the player is faced with two decisions: roll - if the player rolls 1: the player scores nothing and it becomes the opponents turn. 2 - 6: the number is added to the player's turn total and the player's turn continues. hold - The turn total is added to the player's score and it becomes the opponent's turn. This game is a game of probability. Players can use their knowledge of probabilities to make an educated game decision. Assignment specifications Hold-at-20 means that the player will choose to roll...arrow_forwardWrite a void function to find the average score on each test and store in an array testAvgs. Write a void function to print the average score for each student, i.e. print the contents of the array studentAvgs. The output will be well formatted and accompanied with appropriate messages. Write a void function to print the average score on each test, i.e. print the contents of the array testAvgs. The output will be well formatted and accompanied with appropriate messages. Add the following declaration for the array studentsPassing in the function main. bool studentsPassing[MAX_STUDENTS]; Write a function that initializes all components of the array studentsPassing to false. The array studentsPassing is a parameter. void Initialize(bool studentsPassing[],int numberOfStudents) Write a function that has studentsPassing , studentAvgs, and numberOfStudents as parameters. Set the components of passing to true whenever the corresponding value in studentAvgs is greater than or equal to 50.0...arrow_forward
- Python question please include all steps and screenshot of code. Also please provide a docstring, and comments throughout the code, and test the given examples below. Thanks. Write a function diceprob() that takes a possible result r of a roll of pair of dice (i.e. aninteger between 2 and 12) and simulates repeated rolls of a pair of dice until 100 rolls of rhave been obtained. Your function should print how many rolls it took to obtain 100 rollsof r.>>> diceprob(2)It took 4007 rolls to get 100 rolls of 2>>> diceprob(3)It took 1762 rolls to get 100 rolls of 3>>> diceprob(4)It took 1058 rolls to get 100 rolls of 4>>> diceprob(5)It took 1075 rolls to get 100 rolls of 5>>> diceprob(6)It took 760 rolls to get 100 rolls of 6>>> diceprob(7)It took 560 rolls to get 100 rolls of 7arrow_forward8. using c++, Write a function method that determines the mean of all the values in an array of integers. Your mean function should call a separate function that you write that determines the sum. Don’t use built-in sum or mean gadgets, but roll your own.arrow_forwardIn Programming Exercise 13 (Chapter 8), you are asked to write a program to calculate students’ average test scores and their grades. Improve this programming exercise by adding a function to sort students’ names so that students’ data is output into ascending order according to their name. (data.txt) Johnson 85 83 77 91 76 Cooper 78 81 11 90 73 Gupta 92 83 30 69 87 Blair 23 45 96 38 59 Clark 60 85 45 39 67 Kennedy 77 31 52 74 83 Bronson 93 94 89 77 97 Sunny 79 85 28 93 82 Smith 85 72 49 75 63 Aniston 80 90 95 93 48 (Program to Improve) #include <iostream> #include <fstream> #include <string> #include <iomanip> using namespace std; void getData(ifstream& inf, string n[], double tstData[][6], int count); void calculateAverage(double tstData[][6], int count); void calculateGrade(double tstData[][6], char gr[], int count); void print(string n[], double tstData[][6], char gr[], int count); int main() { string names[10]; double...arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- Text book imageDatabase System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationText book imageStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONText book imageDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- Text book imageC How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONText book imageDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningText book imageProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education
Text book image
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
Text book image
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Text book image
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
Text book image
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Text book image
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Text book image
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education