Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Project In c . In this phase, you first need to define: 1-constant called MAXSIZE ( max number of books stored) equal to 100. 2-global

Project In c .

image text in transcribed

image text in transcribed

image text in transcribed

image text in transcribed

image text in transcribed

image text in transcribed

In this phase, you first need to define: 1-constant called MAXSIZE ( max number of books stored) equal to 100. 2-global variable called size =0 (current number of books stored) The main function should define three arrays: int bins[MAXSIZE); double prices[MAXSIZE); int publishYear [MAXSIZE); you now need to implement the major parts of the functions you created in phase one as follows: void displayMainMenu(); // displays the main menu shown above This function will remain similar to that in phase one with one minor addition which is the option: 4- Print Book List which calls the function printBooksInformation...) void uploadDataFile (int bins[], double prices[], int publish Year()); This function will receive the arrays containing the bin (id) numbers and the prices as parameters and the publish year of the book. The function will open a file called books.txt for reading and will read all the book bin numbers, prices and publish year and store them in the arrays. The global 1 variable size should be set to the number of books read from the file and stored in the array. void addBook(int bins[], double prices[], int publishYear[]); This function will receive the arrays containing the bin numbers, the prices, and the publish year. The function will check to see if the list is not full. If list is not full ( size MAXSIZE) then it ask the user to enter a bin number, a price and the publish year and will have one of three choices: 1- if the bin number is already in the list (the book with that bin exists) it will display an error message ("book already exists). 2. If the bin number does not exist, the function will add the book's bin and price and the publish year to the end (at index size ) of the bins and prices and publish Year arrays. The global variable size should be incremented (size++). void removeBook(int bins[], double prices[], int publish Year[]); This function will receive the arrays containing the bin numbers, the prices, and the publish year as parameters. The function will check if the list is not empty. If it is not empty (size > 0) then it will search for the bin number to be removed and if not found will display an error message. If the bin number exists, the function will remove it by deleting the bin number, price and publish year from bins, prices and pulishYear arrays and size will be decremented by 1. void searchFor Book(int bins [], double prices[], int publishYear[]); This function will receive the arrays containing the bin numbers, the prices and the publish year as parameters. The function will check if the list is not empty. If it is not empty (size > 0) then it will ask the user to enter a bin number and will search for that bin number. If the bin number is not found it will display an error message. If the bin number is found then it will be displayed along with the price in a suitable format on the screen. void updateData File(int bins[], double prices[], int publishYear()); This function will receive the arrays containing the bin numbers, the prices, and the publishYear, as parameters. The function will open the file called books.txt for writing and will write to that file the bin number and price of each book in the array. void printBooksInformation (int bins[], double prices[], int publishYear()); // NEW FUNCTION This function will receive the arrays containing the bin numbers, the prices and the publish year as parameters. This function will print the information (bins and prices) currently stored in the arrays. Welcome to My BookStore Managerent System: Uploading data file ... Data File uploaded Please Select an Operation (1-4): 1- Add a Book: 2- Remove a Book: 3- Search for a Book: 4- Print Book List: 5- Exit Systen: 4 bintt = 1234 bin# - 2345 price = 22.45 price - 25.29 Please Select an Operation (1-4): 1- Add a Book: 2- Remove a Book: 3- Search for a Book: 4- Print Book List: 5- Exit Systen: 1 Enter bin number for book 1500 Enter price of book 100.0 Book with bin 1500 has been added Please Select an Operation (1-4): 1- Add a Book: 2- Remove a Book: 3- Search for a Book: 1- PrintBook List: 5- Exit Systen: 1 bin# - 1234 binti = 1500 bint - 2345 price = 22.45 price = 100.00 price 25.29 Please Select an Operation (1-4): 1 - Add a Book: 2- Remove a Book: 3- Search for a Book: 4- Print Book List: 5- Exit Systen: 2 Enter bin number for book to remove 1209 Book with bin 1708 does not exist Please Select an Operation (1-4): 1- Add a Book: 2- Remove a Book: 3- Search for a Book: 1- Print Book List: - Exit Systen: 2 Enter bin number for book to remove 1234 Book with bin 1234 has been removed Please Select an Operation (1-4): 1 - Add a Book: 2- Renove a Book: 2- Search for a Book: 4- Print Book List: 5- Exit Systen! 2 Enter bin nunber for book to renove 2345 Book with bin 2345 has been removed Please Select an Operation (1-4): 1- Add a Book: 2- Renove a Book: 3- Search for a Book: 1- Print Book List: 5- Exit System: Enter bin number for book 1111 Enter price of book 59.9 Book with bin 1111 has been added Please Select an Operation (1-4): 1- Add a Book: 2- Renove a Book: 3- Search for a Book: 1- Print Book List: 5- Exit System: 3 Enter bin number for book to search for 1500 bin# = 1500 price - 100.00 Please Select an Operation (1-4): 1- Add a Book: 2- Remove a Book: 2- Search for a Book: 4- Print Book List: 5- Exit Syster: 4 bint = 1111 price - 60.90 bin# - 1500 price - 100.00 Please Select an Operation (1-4): 1- Add a Book: 2- Remove a Book: 3- Search for a Book: 4- Print Book List: 5- Exit Syster! 1 Enter bin number for book 1444 Enter price of book 150.0 Book with bin 1444 has been added Please Select an Operation (1-4): 1- Add a Book: 2- Remove a Book: 3- Search for a Book: 4- Print Book List: 5- Exit Systen: 4 bin# = 1111 price = 60.90 bin# - 1444 price - 150.00 bin# = 1560 price = 100.00 Please Select an Operation (1-4): 1- Add a Book: 2- Remove a Book: 3- Search for a Book: 4- Print Book List: 5- Exit Systen: 5 Updating data file Data File updated Thank you for using My BookStore Management Systen. GoodBye

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Ehs 2.0 Revolutionizing The Future Of Safety With Digital Technology

Authors: Tony Mudd

1st Edition

B0CN69B3HW, 979-8867463663

More Books

Students also viewed these Databases questions

Question

What are the key steps in diagnosing a conflict situation?

Answered: 1 week ago

Question

What is paper chromatography?

Answered: 1 week ago

Question

Explain the cost of capital.

Answered: 1 week ago