68 471
Assignments Done
98,8%
Successfully Done
In December 2018

# Answer to Question #60611 in C++ for shruti

Question #60611
Define a class book with the following details (use data file):-
Book_no, Book_title,Book_price,Author,Publishing_date, Bill_amt as attributes.
(a) Create a function Total_cost()to calculate cost of 'n' copies 10 coppies
(b)Creat a Function Input() to enter Book_no, Book_title, Book_price, Author, Publishing_date and no of books(n).
(c) A Display() function that displays all the attributes with appropriate prompts(1)
(d) A function to delete a particular book
(e) A function to update book details
Book.h
#pragma once
#include <string>
#include <iostream>

using namespace std;

class Book
{
private:
int Book_no;
string Book_title;
double Book_price;
string Author;
string Publishing_date;
double Bill_amt;
public:
double Total_cost();
void Input();
void Display();
void Delete();
void Update(int, string, double, string, string, double);
Book();
~Book();
};

Book.cpp
#include "Book.h"

Book::Book()
{
}

Book::~Book()
{
}

double Book::Total_cost() {
return (Book_price + Bill_amt) * 10;
}

void Book::Input() {
cout << "Enter No: ";
cin >> Book_no;
cout << "Enter title: ";
getline(cin, Book_title);
cout << "Enter price: ";
cin >> Book_price;
cout << "Enter author: ";
getline(cin, Author);
cout << "Enter publishing date: ";
getline(cin, Publishing_date);
cout << "Enter bill amt: ";
cin >> Bill_amt;
}

void Book::Display() {
cout << "No: " << Book_no << endl
<< "Title: " << Book_title << endl
<< "Price: " << Book_price << endl
<< "Author: " << Author << endl
<< "Publishing date: " << Publishing_date << endl
<< "Bill amt: " << Bill_amt << endl;
}

void Book::Delete() {
this -> ~Book();
}

void Book::Update(int no, string title, double price, string author, string date, double amt) {
this -> Book_no = no;
this->Book_title = title;
this->Book_price = price;
this->Author = author;
this->Publishing_date = date;
this->Bill_amt = amt;
}

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!