Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

C+ Write a menu driven program to define an array of structures to store the details of 50 books in a Book Store The details

C+ image text in transcribed
Write a menu driven program to define an array of structures to store the details of 50 books in a Book Store The details include Book name (string), Book price (float) and Book status (char) (Book status can have two possible values; either A (Available) or N(Not Available)] The program should show a menu by calling the function Show Menu and prompt the user to enter his choice. Program should call the below functions according to the user's choice. If the user selects the exit option, the program should exit. (30 marks) Program should create three user defined functions such as: a) void ShowMenu (void) - This function will display the following menu. (10 marks) 1. Add Book Details 2. Find the average price of the currently available books. b) void BookAdd (void) - This function is called when the user select option 1. The function is used to add the details of a new book into the structure. The function should prompt the user to enter the new book details such as name, price and status and store it into the structure. If the user wants to add more than 50 books, then the following message should be printed on the screen. "Book cannot be added. You have reached the limit!" (25 marks) c) void BookAverage(void) - This function is called when the user selects option 2. This function should calculate and print the average price of all the currently available books in the book store. If the average price is more than 100, then print a message "Books are costly" else print "Books are cheap (25 marks) 3. Exit Add your name and ID as comment at the beginning of the code. (5 marks) Output Format

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

More Books

Students also viewed these Databases questions