Reading Material Purchasing System
------------------------------------------
the program have a book sales
User will select the type of book they want to buy such as Fiction,
non-Fiction

Fiction Non-Fiction
------- -------------
////////....$ /////////////.......$
///////......$ ///////////////....$
///////.....$ //////////....$

at the end (print out)
list down the book they buy
Total of all the book with it price
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
#include <iostream.h>

class Purchase{
private:
int type;
int sum;
char name[][50];
char choose[][50];


public:
Purchase(int =0);
~Purchase(){}
void setData(int =0);
void select();
void calculate();
void print();
};

Purchase::Purchase(int t)
{
type=t;
sum=0;
char name[20][50]={ "A Begineer's Guide, McGraw-Hill/Osborne 2002", "RM57.60",
"Programming in C++, McGraw-Hill, 2003", "RM68.40",
"Schaum's Programming with C++, McGraw Hill, 2000", "RM64.80",
"C++ How to Program, Prentice Hall, 4th Edition (2003)","RM66.60",
"Logic and Computer Design Fundamental, Mano,2000", "RM70.40",
"Computer System Architecture, Hamacher,2002", "RM66.60",
"Understanding Operating System ,Ida M Flynn,2001", "RM46.80",
"Pengenalan Kepada Sistem Komputer,Mc-Graw-Hill,2002", "RM12.60",
"Titas1,Penerbit UM,K.L.2001", "RM32.50"
"Human right and new world order, Penang 1993", "RM45.00"}
}
void Purchase::setData(int t)
{
type=t;
sum=0;
char name[20][50]={ "A Begineer's Guide, McGraw-Hill/Osborne 2002", "RM57.60",
"Programming in C++, McGraw-Hill, 2003", "RM68.40",
"Schaum's Programming with C++, McGraw Hill, 2000", "RM64.80",
"C++ How to Program, Prentice Hall, 4th Edition (2003)","RM66.60",
"Logic and Computer Design Fundamental, Mano,2000", "RM70.40",
"Computer System Architecture, Hamacher,2002", "RM66.60",
"Understanding Operating System ,Ida M Flynn,2001", "RM46.80",
"Pengenalan Kepada Sistem Komputer,Mc-Graw-Hill,2002", "RM12.60",
"Titas1,Penerbit UM,K.L.2001", "RM32.50"
"Human right and new world order, Penang 1993", "RM45.00"}
}
void Purchase::select()
{
if(type==1)
{
cout<<"Select the book(s):\n"
<<"\t1.A Begineer's Guide, McGraw-Hill/Osborne 2002\tRM57.60\n"
<<"\t2.Programming in C++, McGraw-Hill, 2003\tRM68.40\n"
<<"\t3.Schaum's Programming with C++, McGraw Hill, 2000\tRM64.80\n"
<<"\t4.C++ How to Program, Prentice Hall, 4th Edition (2003)\tRM66.60\n";
cin>>p;
!strcmp(
}
else if(type==2)
{
cout<<"Select the book(s):\n"
<<"\t1.Logic and Computer Design Fundamental, Mano,2000\tRM70.40\n"
<<"\t2.Computer System Architecture, Hamacher,2002\tRM66.60\n";
cin>>s;
}
else if(type==3)
{
cout<<"Select the book(s):\n"
<<"1.Understanding Operating System ,Ida M Flynn,2001\tRM46.80\n"
<<"2.Pengenalan Kepada Sistem Komputer,Mc-Graw-Hill,2002\tRM12.60\n";
cin>>o;
}
else if(type==4)
{
cout<<"Select the book(s):\n"
<<"1.Titas1,Penerbit UM,K.L.2001\tRM32.50\n"
<<"2.Human right and new world order, Penang 1993\tRM45.00\n";
cin>>t;
}
}

void Purchase::calculate()
{


void main()
{
Purchase obj;
cout<<"Type of Book:\n"
<<"\t1.Programming\n"
<<"\t2.System & Architecture\n"
<<"\t3.Operating System\n"
<<"\t4.Other\n"
<<"\t5.Submit\n";
cin>>t;
obj.setData(t);
obj.select();
obj.calculate();
obj.print();
}
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
RM mean Malaysian Dollar
This program is still in process
I need Your help
Helppp........... :confused:

What specifically do you need help with?

I am getting an apache server DoS attach everytime i open this post so beware. IT is only this post not the forum

What specifically do you need help with?

first:
Type of book there:
When the user key in number
....................................................................................

Type of Book
1.Programming
2.Other
....................................................................................
user input 1.
go to 1.
....................................................................................
No. List of Book
1. C++ Beginner Guide................RM64.20
2. C++ Make Live Easy...............RM70.00
3. C++ is not Hard.....................RM45.00
...................................................................................
user input 1.
comfirm he/she want to buy the book
...................................................................................
Do you want to buy the book?
...................................................................................
Yes
ask the user want buy some more Programming book or not
...................................................................................
Do you want to buy Programming Book(S) some more?
..................................................................................
Yes
...................................................................................
No. List of Book
1. C++ Beginner Guide................RM64.20
2. C++ Make Live Easy...............RM70.00
3. C++ is not Hard.....................RM45.00

....................................................................................
(repeat same process)
if no
ask the user want to buy other book?
like Other book
if yes
Go back the general list ie.
...................................................................................
Type of Book
1.Programming
2.Other
..................................................................................
Ask the user to enter example 2.
The no 2 book is listed out.....
(repeat like the programming process)

At the end if the user really confirm and want to end the service

a list of book will prompt out(that the user buy)
with price and Total have to pay:

When print out the list of the book that are selected by user(with price)
Just like this:
...................................................................................

No Books RM
1 System and Architecture..........RM50.00
2. Operating System...................RM46.50
3. Titas2...................................RM40.00
Total....................................RM136.50
Thank you.
..................................................................................
Can you edit my source code?
Can you give me some example (that help me in doing this program), or other idea to solve it? ;)
Thank you

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.