Answer to Question #206719 in C++ for SWB

Question #206719

Create software that has multiple features to handle books management. Book shop have 100 books for customers.The shop gives book on rent and charge per day according to type of book.Write a main function that will display these options 1.Rent a Book 2.Calculate total amount of all currently Rented Books 3.Exit program.Ask Repeatedly by showing menu unless user exit program Create Structure to store this data for each book I.e (for 100 books) Book Id, Book name, Customer name, Type of book (Novel=2000, Academic=1500, Philosophy=2000, Islamic=1000), No of days.Create a Structure array of Books for 100 Books data.Program should calculate total fee of all rented books in shop currently to keep.You need to firstly calculate fee for each book separately by checking their days and then finally you have to calculate all amount of currently rented books. also show customer name of book who have payed most amount. Finally get count of available book along with type and display.


1
Expert's answer
2021-06-14T04:58:40-0400
#include <iostream>

struct book {
  std::string name, custormer;
  int days;
  long long int id;
  std::string type;
};

struct book library[100];

void rent_a_book();

void calc_total_amount();

int main()
{
  while ( true ) 
  {
    std::cout << "Rent a Book" << std::endl;
    std::cout << "Calculate total amount of all currency Rented Books" << std::endl;
    std::cout << "Exit the program" << std::endl;
    int n;
    std::cin >> n;
    switch ( n ) {
      case 1:
        rent_a_book();
        break;
      case 2:
        calc_total_amount();
        break;
      case 3:
        std::cout << "Exit the system" << std::endl();
        break;
      default:
        std::cout << "Oops.." << std::endl;
    }
  }
  return 0;
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog