The following is a class diagram for class textBook and the main() program. The
class consists of 3 data members and 4 function members. Write a complete
C++ program that is able to do the following tasks:
textBook
bookName : char[]
bookPrice : float
totalInStock : int
Constructor
orderBook(int):void
checkQty() : float
printDetail() : void
main()
{
textBook classBook("Learning C",150.00,200);
textbook storyBook("Upin Ipin");
classBook.orderBook(20);
cout << "Total book in stock " << storyBook.checkQty();
storyBook.printDetail();
:
}
Write a class definition based on the class diagram above. Declare the data
members as private, while the member functions as public.
Write implementation function for the following member function:
Write the implementation (source codes) for the constructor that will initialize
data members based on the parameter value send to the constructor.
Write code for orderBook(int) function that will add the number of book in
stock. If the number of book in stock is less than 10 books, add some more
book based on the value send in the parameter. Do not add any book, if the
number of book is 10 or more. Give appropriate message if no book is added
into the stock.
Write code for checkQty() that will return the total number of book in stock.
Write the code for member function printDetail()that print the name of the
book.
Rewrite main() program that will declare an array of textbook and read
information about the textbook from a data file.
Implement all member functions through the element of the array.
Divide the program into header files and implementation files. Compile cpp
files, link and create project file.
Declare a non-member function buyBook that receive an array of textBook.
The function will ask the user to key-in the name of the book to buy and the
amount of book being bought. Use a loop to find the appropriate book and
update the number of books after the buying process has been done.
void buyBook(textbook []); // non-member function
Write your own function that is able to implement the concept function that
return a class (class textbook)
I think he is asking us to post a codez. I seriously think that this is from a programming professional, not someone in a class they probably shouldn't be in.