hello
how are you ??

I sing here because i know that you will help me.:)

I have a difficult:( assignment and I have to give it to the teacher tomorrow at 9 am, It’s about the class and it says


A. Some of the characteristics of a book are the title, author(s), publisher, ISBN, price, and year of publication. Design a class bookType that defines the book as an ADT.
i. Each object of the class bookType can hold the following information about a book: title, up to four authors, publisher, ISBN, price, and number of copies in stock. To keep track of the number of authors, add another member variable.
ii. Include the member functions to perform the various operations on objects of type bookType. For example, the usual operations that can be preformed on the title are to show the title, set the title, and check whether the title is the same as the actual title of the book. Similarly, the typical operations that can be preformed 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 operations for the publisher, ISBN, book price, and authors. Add the appropriate constructors and destructor (if one is needed).

B. Write the definitions of the member functions of the class bookType.

C. Write a program that uses the class bookType and tests various operations on the objects of the class bookType. Declare an array of 100 components of the type bookType. Some of the operations that you should perform are to search for a book by title, search by ISBN, and update the number of copies of a book.


I am waiting for your help.

thankyou

Comments
We don't do homework.

No one here is going to write your program for you. You should have started on that at least a week ago if it's due tomorrow. So much for your procrastination.

The assignment seems pretty clear to me. Do you know how to create a class? No, then study your textbook.

Edited 6 Years Ago by Ancient Dragon: n/a

To be able to do this you have to study 2 simple things :
1.Read this site http://www.cplusplus.com/doc/tutorial/classes/
Okay after you done that try understand what this program does ( it's not your homework , just random program to show classes)

/*
Assigment : using classes make a program to calculate gcd (Greatest_common_divisor)
*/

#include <iostream>

using namespace std;

int a,b;

int Show(int b){
    // showing the answer
    cout<<"Answer : "<<b;
}

int Calculate(int a,int b){
   // I am going to calculate the gcd
    int r;
     for(r=a%b; r; a=b, b=r, r=a%b);
  Show(b);
}

void Read(){
     //reading numbers
     cout<<"Enter Numbers ";
     cin>>a>>b;
     Calculate(a,b);
}

int main(){
    //Making It Happen;
    Read();
}

Part 2 ;
Searching in string ;

What is a string ?

String objects are a special type of container, specifically designed to operate with sequences of characters.
Unlike traditional c-strings, which are mere sequences of characters in a memory array, C++ string objects belong to a class with many built-in features to operate with strings in a more intuitive way and with some additional useful features common to C++ containers.

More Info at http://www.cplusplus.com/reference/string/string/
How to search in a string ?
Read this :
http://www.cplusplus.com/reference/string/string/find/

Hope this helped .. I kinda did your homework .:-/ . Hope didn't do something wrong again

Edited 6 Years Ago by Robert1995: forgot to say something

Comments
To help fix Jeph's booboo =)
To help fix Jeph's booboo =)
we don't do slacker's homework

Other than the fact that your first example didn't use classes at all, you did fine.

An example class:

//class.h file
//an example class
class exampleClass {
private:
  int memberInt;

protected:

public:
  exampleClass() : memberInt(0) {}  //default constructor
  exampleClass(int newMemInt) : memberInt(newMemInt) {} //specified constructor
  ~exampleClass() {}  //destructor
  void setInteger(int newInteger)
  void showDoubledMember();
};  //end class declaration
//class.cpp file
void exampleClass::setInteger(int newInteger)  //implement setInteger()
{
  memberInt = newInteger;
}

void exampleClass::showDoubledMember()  //implement showDoubledMember()
{
  cout << memberInt << " doubled is: " << memberInt * 2 << endl;
}

Edited 6 Years Ago by Fbody: n/a

Comments
Nothing wrong with this post :)
To help fix Jeph's booboo =)
we don't do homework

really want to see the poster's face when he will get up in the morning and won't see his homework made

oh, oops. sorry for the neg rep to Robert and FBody.

I'll find a post to give you green on tomorrow. maybe someone else will make your posts, above, green too.

my bad.

This article has been dead for over six months. Start a new discussion instead.