Answer to Question #255170 in C++ for Jaganathan

Question #255170
Define a class BOOK with the following specifications: PRIVATE DATA MEMBERS: BNO integer type BOOKTITLE 30 characters COPIES integer type PRICE float type AMOUNT float type
1
Expert's answer
2021-10-22T07:39:46-0400
#include<iostream>
using namespace std;
class BOOK{
	private:
		int BNO;
		char BOOKTITLE [30];
		int COPIES;
		float PRICE;
void TOTAL_COST(int N)
{
float tcost;
tcost=PRICE*N;
cout<<tcost;
}
public:
void INPUT( )
{
cout<<"Enter Book Number ";
cin>>BNO;
cout<<"Enter Book Title ";
gets(BOOKTITLE);
cout<<"Enter price per copy ";
cin>>PRICE;
}
void PURCHASE( )
{
int n;
cout<<"Enter number of copies to purchase ";
cin>>n;
cout<<"Total cost is ";
TOTAL_COST(n);
}
};
int main( )
{
BOOK obj;
obj.INPUT( );
obj.PURCHASE( );


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
APPROVED BY CLIENTS