#include<iostream>
#include<string>
using namespace std;
class BOOK
{
int book_no;
string book_title;
float price;
float TOTAL_COST(int N)
{
return N*price;
}
public:
void INPUT()
{
cout<<"Enter Book Number : ";
cin>>book_no;
cout<<"Enter Book Title : ";
getline(cin,book_title);
getline(cin,book_title);
cout<<"Enter price : ";
cin>>price;
}
void PURCHASE()
{
int n;
cout<<"\nEnter the number of copies to be purchased : ";
cin>>n;
float total_price=TOTAL_COST(n);
cout<<"Total Price : "<<total_price;
}
void SHOWINFO()
{
cout<<"Book Number : "<<book_no;
cout<<"\nBook Title : "<<book_title;
cout<<"\nPrice : "<<price;
PURCHASE();
}
};
int main()
{
BOOK b1;
b1.INPUT();
b1.SHOWINFO();
}
Output:
Comments
Leave a comment