can anyone explain actually wat do they mean by this program
@TuringTest help pls
What lang?
c++
u can just explain it so that i can understand it
@KonradZuse
Ok so.
Lets step through this. Some of the characteristics of a book are the title, author(s), publisher, ISBN, price and year of publication. Design a class bookType that defined the book as an Abstract Data Type (ADT).
I'm mainly a Java programmer, but this is what you need to do.
You have your class Booktype. You will have methods for title, pushlisher, etc. Include the member functions to perform the various operations on objects of type bookType. For example, the usual operations that can be performed on the title are to show the title, set the title, and check whether a title is the same as the actual title of the book. so you would need a set method to set the title, and then a getter method that not only returns the title, but checks to see if the title is correct.
Similarly, the typical operations that can be performed on the number of copies in stock are to show the number of copies in stock, set the number of copies in stock, update the number of copies in stock, and return the number of copies in stock. Add similar operation for the publisher, ISBN, book price, and authors. Add the appropriate constructors and destructor (if one is needed). Same for the copies in stock.
the rest goes on, do you understand?
does it mean my data member will contain tittle,isb,etc
do the books originally stored or i first store them
number e i don't understand it
my code in java would look like this. class bookType { int copies; String title; bookType() //constructor that accepts null arguments, you should add your title and such here. public void setTitle(string s) { this.title = s; } public String getTitle() { if(title = verify title) { return title; } else invalid. etx
definitions I guess are comments and such, nt too sure either.
hmmm?
This program is all about ADT stuffs . in C++ you have to use a class called "bookType" which contain both set function and get functions. that is, you should have a functions to set ISB , to get ISB ,to set Title ,to get title etc ...NOTE that all set function have the corresponding get function (get function usually just return something ) constructor is a must . I think now you can get started ...
read number e tell me wat does it mean
OK for you to use a class in c++ you have to declare an object of that class type .example to use integer you have to declare it first that is int x; now x is you variable which carries an integers . now back to business class is our type just like int we must have bookType NameOurObject[50]; but is not advised to use exact value ; so int size =50; bookType NameOurObject[size];
where am i gonna use this statement?
and how to use this statement? is it gonna be in main ?
yes it has to be in main a class has to be separate just like mr Matjuda said
yes but i want to know wat is the purpose of it in main
can u pls try to write a simple code for that
put it does not have everything
to use our object here we have to have array separate to the previous one . don,t your the previous array use #include "bookType.h" // for our class booktype #include <iostream> #include<cstring> int main () { bookType NameOurObject; string title; //this will set the book title cout<<"pls enter book title :"; cin>>title; NameOurObject.SetTitle(title); //this will print the title NameOurObject.getTitle(); return 0; }
Join our real-time social learning platform and learn together with your friends!