SlideShare a Scribd company logo
1 of 17
Download to read offline
#include "stdafx.h"
#include
#include
using namespace std;
const int MAX_ARRAY_SIZE = 4;
class memberType {
public:
string name; // Name of the person
int id; // Member ID
int n_books; // Number of books
double amount; // Total amount spent
public:
memberType();
memberType(string ID, string first, string last, int books, double amount);
//
void setMemberInfo(string ID, string fName, string lName, int bPurchased, double amount);
// member Name access methods
void setMemberID(string);
void setName(string, string); // set new name
string getName(); // get Name
bool isMemberID(string) const;
int getBooksPurchased() const;
double getTotalAmountSpent() const;
void purchaseBook(double amount);
void resetbooksBoughtAndAmount();
void printMemberID() const;
void printName() const;
void printInfo() const;
private:
string memberID;
string firstName;
string lastName;
int booksPurchased;
double amountSpent;
};
class bookType
{
public:
void setTitle(string); //functions dealing with the title
string getTitle();
bool compareTitle(string);
//functions dealing with the copies of book
void setCopies(int);
void showCopies();
void updateCopies(int);
int getCopies();
void setPublisher(string); //functions dealing with publisher of book
void showPublisher();
void updatePublisher(string);
string getPublisher();
void setISBN(string); //functions dealing with ISBN of book
void showISBN();
void updateISBN(string);
string getISBN();
bool compareISBN(string);
void setPrice(double bookPrice); //functions dealing with price of book
void showPrice();
void updatePrice(double compPrice);
double getPrice();
void setAuthors(string); //functions dealing with author of book
void showAuthors();
void updateAuthor(string compAuthor);
string getAuthors(int i); //ith number of author will return
bookType();
private:
string title;
string authors[4]; //objects of type bookType can contain up to 4 authors
string publisher;
string ISBN;
double price;
int copies;
int authorsNo;
};
bookType::bookType()
{
title = "";
for (int i = 0; i < 4; i++)
authors[i] = "";
publisher = "";
ISBN = "";
price = 0;
copies = 0;
authorsNo = 0;
}
void bookType::setTitle(string myTitle)
{
title = myTitle;
}
string bookType::getTitle()
{
return title;
}
bool bookType::compareTitle(string otherTitle)
{
return (title.compare(otherTitle) == 0);
}
void bookType::setAuthors(string myAuthor)
{
authorsNo = authorsNo % 4;
if (myAuthor.compare("") == 0)
return;
else
{
authors[authorsNo] = myAuthor; //store the author name
authorsNo++; //keep track of authors count
}
}
void bookType::showAuthors()
{
for (int i = 0; i < authorsNo; i++)
cout << authors[i] << ", ";
cout << "  ";
}
void bookType::updateAuthor(string myAuthor)
{
setAuthors(myAuthor);
}
string bookType::getAuthors(int i)
{
return authors[i];
}
void bookType::setCopies(int myCopies)
{
copies = myCopies;
}
void bookType::showCopies()
{
cout << " tThe number of copies " << copies;
}
void bookType::updateCopies(int myCopies)
{
copies = myCopies;
}
int bookType::getCopies()
{
return copies;
}
void bookType::setPublisher(string myPublisher)
{
publisher = myPublisher;
}
void bookType::showPublisher()
{
cout << publisher;
}
void bookType::updatePublisher(string myPublisher)
{
publisher = myPublisher;
}
string bookType::getPublisher()
{
return publisher;
}
void bookType::setISBN(string myISBN)
{
ISBN = myISBN;
}
void bookType::showISBN()
{
cout << ISBN;
}
void bookType::updateISBN(string myISBN)
{
ISBN = myISBN;
}
string bookType::getISBN()
{
return ISBN;
}
bool bookType::compareISBN(string myISBN)
{
return (myISBN.compare(myISBN));
}
void bookType::setPrice(double myPrice)
{
price = myPrice;
}
void bookType::showPrice()
{
cout << " tThe book price is " << price;
}
void bookType::updatePrice(double myPrice)
{
price = myPrice;
}
double bookType::getPrice()
{
return price;
}
memberType::memberType()
{
memberID = "";
firstName = "";
lastName = "";
booksPurchased = 0;
amountSpent = 0;
}
memberType::memberType(string ID, string first, string last, int books, double amount)
{
memberID = ID;
firstName = first;
lastName = last;
booksPurchased = books;
amountSpent = amount;
}
// member Name access methods
void memberType::setMemberInfo(string ID, string fName, string lName, int bPurchased,
double amount)
{
memberID = ID;
firstName = fName;
lastName = lName;
booksPurchased = bPurchased;
amountSpent = amount;
}
// member Id access methods
void memberType::setMemberID(string id)
{
memberID = id;
}
void memberType::setName(string fName, string lName)
{
firstName = fName;
lastName = lName;
}
bool memberType::isMemberID(string id) const
{
return memberID == id;
}
int memberType::getBooksPurchased() const
{ // get number of books
return booksPurchased;
}
double memberType::getTotalAmountSpent() const
{
return amountSpent;
}
// Books methods
void memberType::purchaseBook(double price)
{
amountSpent += price; // more money have been spent
booksPurchased++; // and more books has been aquired
}
void memberType::resetbooksBoughtAndAmount()
{
amountSpent = 0;
booksPurchased = 0;
}
void memberType::printMemberID() const
{
cout << memberID;
}
void memberType::printName() const
{
cout << firstName << " " << lastName;
}
void memberType::printInfo() const
{
printMemberID(); cout << endl;
printName(); cout << endl;
cout << booksPurchased << endl;
cout << amountSpent << endl;
}
void showChoices();
int main()
{
int choice; // holds the selection
do
{
showChoices();
cin >> choice;
cout << endl;
switch (choice)
{
case 'a':
break;
case 'b':
break;
default:
void memberType::printInfo() const;
///*default:
// cout << "Invalid input." << endl;
//}*/
} while (choice != 99);
}
void showChoices()
{
cout << "Enter--" << endl;
cout << "1: MemberInfo:" << endl;
cout << "2: Number of books purchased:" << endl;
cout << "3: Spent Amount: " << endl;
cout << "99:To quit the program." << endl;
}
Solution
#include "stdafx.h"
#include
#include
using namespace std;
const int MAX_ARRAY_SIZE = 4;
class memberType {
public:
string name; // Name of the person
int id; // Member ID
int n_books; // Number of books
double amount; // Total amount spent
public:
memberType();
memberType(string ID, string first, string last, int books, double amount);
//
void setMemberInfo(string ID, string fName, string lName, int bPurchased, double amount);
// member Name access methods
void setMemberID(string);
void setName(string, string); // set new name
string getName(); // get Name
bool isMemberID(string) const;
int getBooksPurchased() const;
double getTotalAmountSpent() const;
void purchaseBook(double amount);
void resetbooksBoughtAndAmount();
void printMemberID() const;
void printName() const;
void printInfo() const;
private:
string memberID;
string firstName;
string lastName;
int booksPurchased;
double amountSpent;
};
class bookType
{
public:
void setTitle(string); //functions dealing with the title
string getTitle();
bool compareTitle(string);
//functions dealing with the copies of book
void setCopies(int);
void showCopies();
void updateCopies(int);
int getCopies();
void setPublisher(string); //functions dealing with publisher of book
void showPublisher();
void updatePublisher(string);
string getPublisher();
void setISBN(string); //functions dealing with ISBN of book
void showISBN();
void updateISBN(string);
string getISBN();
bool compareISBN(string);
void setPrice(double bookPrice); //functions dealing with price of book
void showPrice();
void updatePrice(double compPrice);
double getPrice();
void setAuthors(string); //functions dealing with author of book
void showAuthors();
void updateAuthor(string compAuthor);
string getAuthors(int i); //ith number of author will return
bookType();
private:
string title;
string authors[4]; //objects of type bookType can contain up to 4 authors
string publisher;
string ISBN;
double price;
int copies;
int authorsNo;
};
bookType::bookType()
{
title = "";
for (int i = 0; i < 4; i++)
authors[i] = "";
publisher = "";
ISBN = "";
price = 0;
copies = 0;
authorsNo = 0;
}
void bookType::setTitle(string myTitle)
{
title = myTitle;
}
string bookType::getTitle()
{
return title;
}
bool bookType::compareTitle(string otherTitle)
{
return (title.compare(otherTitle) == 0);
}
void bookType::setAuthors(string myAuthor)
{
authorsNo = authorsNo % 4;
if (myAuthor.compare("") == 0)
return;
else
{
authors[authorsNo] = myAuthor; //store the author name
authorsNo++; //keep track of authors count
}
}
void bookType::showAuthors()
{
for (int i = 0; i < authorsNo; i++)
cout << authors[i] << ", ";
cout << "  ";
}
void bookType::updateAuthor(string myAuthor)
{
setAuthors(myAuthor);
}
string bookType::getAuthors(int i)
{
return authors[i];
}
void bookType::setCopies(int myCopies)
{
copies = myCopies;
}
void bookType::showCopies()
{
cout << " tThe number of copies " << copies;
}
void bookType::updateCopies(int myCopies)
{
copies = myCopies;
}
int bookType::getCopies()
{
return copies;
}
void bookType::setPublisher(string myPublisher)
{
publisher = myPublisher;
}
void bookType::showPublisher()
{
cout << publisher;
}
void bookType::updatePublisher(string myPublisher)
{
publisher = myPublisher;
}
string bookType::getPublisher()
{
return publisher;
}
void bookType::setISBN(string myISBN)
{
ISBN = myISBN;
}
void bookType::showISBN()
{
cout << ISBN;
}
void bookType::updateISBN(string myISBN)
{
ISBN = myISBN;
}
string bookType::getISBN()
{
return ISBN;
}
bool bookType::compareISBN(string myISBN)
{
return (myISBN.compare(myISBN));
}
void bookType::setPrice(double myPrice)
{
price = myPrice;
}
void bookType::showPrice()
{
cout << " tThe book price is " << price;
}
void bookType::updatePrice(double myPrice)
{
price = myPrice;
}
double bookType::getPrice()
{
return price;
}
memberType::memberType()
{
memberID = "";
firstName = "";
lastName = "";
booksPurchased = 0;
amountSpent = 0;
}
memberType::memberType(string ID, string first, string last, int books, double amount)
{
memberID = ID;
firstName = first;
lastName = last;
booksPurchased = books;
amountSpent = amount;
}
// member Name access methods
void memberType::setMemberInfo(string ID, string fName, string lName, int bPurchased,
double amount)
{
memberID = ID;
firstName = fName;
lastName = lName;
booksPurchased = bPurchased;
amountSpent = amount;
}
// member Id access methods
void memberType::setMemberID(string id)
{
memberID = id;
}
void memberType::setName(string fName, string lName)
{
firstName = fName;
lastName = lName;
}
bool memberType::isMemberID(string id) const
{
return memberID == id;
}
int memberType::getBooksPurchased() const
{ // get number of books
return booksPurchased;
}
double memberType::getTotalAmountSpent() const
{
return amountSpent;
}
// Books methods
void memberType::purchaseBook(double price)
{
amountSpent += price; // more money have been spent
booksPurchased++; // and more books has been aquired
}
void memberType::resetbooksBoughtAndAmount()
{
amountSpent = 0;
booksPurchased = 0;
}
void memberType::printMemberID() const
{
cout << memberID;
}
void memberType::printName() const
{
cout << firstName << " " << lastName;
}
void memberType::printInfo() const
{
printMemberID(); cout << endl;
printName(); cout << endl;
cout << booksPurchased << endl;
cout << amountSpent << endl;
}
void showChoices();
int main()
{
int choice; // holds the selection
do
{
showChoices();
cin >> choice;
cout << endl;
switch (choice)
{
case 'a':
break;
case 'b':
break;
default:
void memberType::printInfo() const;
///*default:
// cout << "Invalid input." << endl;
//}*/
} while (choice != 99);
}
void showChoices()
{
cout << "Enter--" << endl;
cout << "1: MemberInfo:" << endl;
cout << "2: Number of books purchased:" << endl;
cout << "3: Spent Amount: " << endl;
cout << "99:To quit the program." << endl;
}

More Related Content

Similar to #include stdafx.h#include iostream#include Stringusing.pdf

813 LAB Library book sorting Note that only maincpp can .pdf
813 LAB Library book sorting Note that only maincpp can .pdf813 LAB Library book sorting Note that only maincpp can .pdf
813 LAB Library book sorting Note that only maincpp can .pdfsastaindin
 
maincpp include ListItemh include ltstringgt in.pdf
maincpp include ListItemh include ltstringgt in.pdfmaincpp include ListItemh include ltstringgt in.pdf
maincpp include ListItemh include ltstringgt in.pdfabiwarmaa
 
2.overview of c++ ________lecture2
2.overview of c++  ________lecture22.overview of c++  ________lecture2
2.overview of c++ ________lecture2Warui Maina
 
From android/java to swift (3)
From android/java to swift (3)From android/java to swift (3)
From android/java to swift (3)allanh0526
 
(C++ programming)menu quit, book show, book change, book remo.docx
(C++ programming)menu  quit, book show, book change, book remo.docx(C++ programming)menu  quit, book show, book change, book remo.docx
(C++ programming)menu quit, book show, book change, book remo.docxajoy21
 
Type Driven Development with TypeScript
Type Driven Development with TypeScriptType Driven Development with TypeScript
Type Driven Development with TypeScriptGarth Gilmour
 
fully comments for my program, thank you will thumb up#include io.pdf
fully comments for my program, thank you will thumb up#include io.pdffully comments for my program, thank you will thumb up#include io.pdf
fully comments for my program, thank you will thumb up#include io.pdfarjuncp10
 
I keep getting an error about m_pHead in printStoresInfo(); function.pdf
I keep getting an error about m_pHead in printStoresInfo(); function.pdfI keep getting an error about m_pHead in printStoresInfo(); function.pdf
I keep getting an error about m_pHead in printStoresInfo(); function.pdfflashfashioncasualwe
 
File yuan.h#include iostream#include fstream#include .pdf
File yuan.h#include iostream#include fstream#include .pdfFile yuan.h#include iostream#include fstream#include .pdf
File yuan.h#include iostream#include fstream#include .pdfMALASADHNANI
 
Help with the following code1. Rewrite to be contained in a vecto.pdf
Help with the following code1. Rewrite to be contained in a vecto.pdfHelp with the following code1. Rewrite to be contained in a vecto.pdf
Help with the following code1. Rewrite to be contained in a vecto.pdfezzi97
 
Алексей Кутумов, Вектор с нуля
Алексей Кутумов, Вектор с нуляАлексей Кутумов, Вектор с нуля
Алексей Кутумов, Вектор с нуляSergey Platonov
 
Object Calisthenics em Go
Object Calisthenics em GoObject Calisthenics em Go
Object Calisthenics em GoElton Minetto
 
C++: Constructor, Copy Constructor and Assignment operator
C++: Constructor, Copy Constructor and Assignment operatorC++: Constructor, Copy Constructor and Assignment operator
C++: Constructor, Copy Constructor and Assignment operatorJussi Pohjolainen
 
This is the main file include itemh include itemList.pdf
This is the main file include itemh include itemList.pdfThis is the main file include itemh include itemList.pdf
This is the main file include itemh include itemList.pdfinfo334223
 
include ltfunctionalgt include ltiteratorgt inclu.pdf
include ltfunctionalgt include ltiteratorgt inclu.pdfinclude ltfunctionalgt include ltiteratorgt inclu.pdf
include ltfunctionalgt include ltiteratorgt inclu.pdfnaslin841216
 
So basically I worked really hard on this code in my CS150 class and.pdf
So basically I worked really hard on this code in my CS150 class and.pdfSo basically I worked really hard on this code in my CS150 class and.pdf
So basically I worked really hard on this code in my CS150 class and.pdfeyewaregallery
 
Domain Driven Design with the F# type System -- NDC London 2013
Domain Driven Design with the F# type System -- NDC London 2013Domain Driven Design with the F# type System -- NDC London 2013
Domain Driven Design with the F# type System -- NDC London 2013Scott Wlaschin
 

Similar to #include stdafx.h#include iostream#include Stringusing.pdf (20)

813 LAB Library book sorting Note that only maincpp can .pdf
813 LAB Library book sorting Note that only maincpp can .pdf813 LAB Library book sorting Note that only maincpp can .pdf
813 LAB Library book sorting Note that only maincpp can .pdf
 
maincpp include ListItemh include ltstringgt in.pdf
maincpp include ListItemh include ltstringgt in.pdfmaincpp include ListItemh include ltstringgt in.pdf
maincpp include ListItemh include ltstringgt in.pdf
 
2.overview of c++ ________lecture2
2.overview of c++  ________lecture22.overview of c++  ________lecture2
2.overview of c++ ________lecture2
 
From android/java to swift (3)
From android/java to swift (3)From android/java to swift (3)
From android/java to swift (3)
 
(C++ programming)menu quit, book show, book change, book remo.docx
(C++ programming)menu  quit, book show, book change, book remo.docx(C++ programming)menu  quit, book show, book change, book remo.docx
(C++ programming)menu quit, book show, book change, book remo.docx
 
Type Driven Development with TypeScript
Type Driven Development with TypeScriptType Driven Development with TypeScript
Type Driven Development with TypeScript
 
fully comments for my program, thank you will thumb up#include io.pdf
fully comments for my program, thank you will thumb up#include io.pdffully comments for my program, thank you will thumb up#include io.pdf
fully comments for my program, thank you will thumb up#include io.pdf
 
I keep getting an error about m_pHead in printStoresInfo(); function.pdf
I keep getting an error about m_pHead in printStoresInfo(); function.pdfI keep getting an error about m_pHead in printStoresInfo(); function.pdf
I keep getting an error about m_pHead in printStoresInfo(); function.pdf
 
File yuan.h#include iostream#include fstream#include .pdf
File yuan.h#include iostream#include fstream#include .pdfFile yuan.h#include iostream#include fstream#include .pdf
File yuan.h#include iostream#include fstream#include .pdf
 
Help with the following code1. Rewrite to be contained in a vecto.pdf
Help with the following code1. Rewrite to be contained in a vecto.pdfHelp with the following code1. Rewrite to be contained in a vecto.pdf
Help with the following code1. Rewrite to be contained in a vecto.pdf
 
Pointer
PointerPointer
Pointer
 
Алексей Кутумов, Вектор с нуля
Алексей Кутумов, Вектор с нуляАлексей Кутумов, Вектор с нуля
Алексей Кутумов, Вектор с нуля
 
Object Calisthenics em Go
Object Calisthenics em GoObject Calisthenics em Go
Object Calisthenics em Go
 
C++: Constructor, Copy Constructor and Assignment operator
C++: Constructor, Copy Constructor and Assignment operatorC++: Constructor, Copy Constructor and Assignment operator
C++: Constructor, Copy Constructor and Assignment operator
 
Composite Pattern
Composite PatternComposite Pattern
Composite Pattern
 
This is the main file include itemh include itemList.pdf
This is the main file include itemh include itemList.pdfThis is the main file include itemh include itemList.pdf
This is the main file include itemh include itemList.pdf
 
include ltfunctionalgt include ltiteratorgt inclu.pdf
include ltfunctionalgt include ltiteratorgt inclu.pdfinclude ltfunctionalgt include ltiteratorgt inclu.pdf
include ltfunctionalgt include ltiteratorgt inclu.pdf
 
Day 1
Day 1Day 1
Day 1
 
So basically I worked really hard on this code in my CS150 class and.pdf
So basically I worked really hard on this code in my CS150 class and.pdfSo basically I worked really hard on this code in my CS150 class and.pdf
So basically I worked really hard on this code in my CS150 class and.pdf
 
Domain Driven Design with the F# type System -- NDC London 2013
Domain Driven Design with the F# type System -- NDC London 2013Domain Driven Design with the F# type System -- NDC London 2013
Domain Driven Design with the F# type System -- NDC London 2013
 

More from anokhilalmobile

option E .Na2co3 hydrolysyes and gives NaoH which.pdf
                     option E .Na2co3 hydrolysyes and gives NaoH which.pdf                     option E .Na2co3 hydrolysyes and gives NaoH which.pdf
option E .Na2co3 hydrolysyes and gives NaoH which.pdfanokhilalmobile
 
non polar molecules such as lipids and cholestrol.pdf
                     non polar molecules such as lipids and cholestrol.pdf                     non polar molecules such as lipids and cholestrol.pdf
non polar molecules such as lipids and cholestrol.pdfanokhilalmobile
 
moles = molarity x volume = 4.25 molL x 2.50 L =.pdf
                     moles = molarity x volume = 4.25 molL x 2.50 L =.pdf                     moles = molarity x volume = 4.25 molL x 2.50 L =.pdf
moles = molarity x volume = 4.25 molL x 2.50 L =.pdfanokhilalmobile
 
Londondispersionvan der Waals forces - these ar.pdf
                     Londondispersionvan der Waals forces - these ar.pdf                     Londondispersionvan der Waals forces - these ar.pdf
Londondispersionvan der Waals forces - these ar.pdfanokhilalmobile
 
[H2SO4] = 0 because H2SO4 is a strong acid. first consider Ka2.pdf
[H2SO4] = 0 because H2SO4 is a strong acid. first consider Ka2.pdf[H2SO4] = 0 because H2SO4 is a strong acid. first consider Ka2.pdf
[H2SO4] = 0 because H2SO4 is a strong acid. first consider Ka2.pdfanokhilalmobile
 
You ordered a chest X-ray and saw fluid buildup in her right lung. S.pdf
You ordered a chest X-ray and saw fluid buildup in her right lung. S.pdfYou ordered a chest X-ray and saw fluid buildup in her right lung. S.pdf
You ordered a chest X-ray and saw fluid buildup in her right lung. S.pdfanokhilalmobile
 
why would you be the best candidate for the nursing programSTATEM.pdf
why would you be the best candidate for the nursing programSTATEM.pdfwhy would you be the best candidate for the nursing programSTATEM.pdf
why would you be the best candidate for the nursing programSTATEM.pdfanokhilalmobile
 
when the data value is passed between two different operating system.pdf
when the data value is passed between two different operating system.pdfwhen the data value is passed between two different operating system.pdf
when the data value is passed between two different operating system.pdfanokhilalmobile
 
Using mathematical induction,STEP 1The base n = 1 is clearl.pdf
Using mathematical induction,STEP 1The base n = 1 is clearl.pdfUsing mathematical induction,STEP 1The base n = 1 is clearl.pdf
Using mathematical induction,STEP 1The base n = 1 is clearl.pdfanokhilalmobile
 
The process include many steps which could be planning and preparati.pdf
The process include many steps which could be planning and preparati.pdfThe process include many steps which could be planning and preparati.pdf
The process include many steps which could be planning and preparati.pdfanokhilalmobile
 
The FCPA established criminal and civil penalties for unlawful payme.pdf
The FCPA established criminal and civil penalties for unlawful payme.pdfThe FCPA established criminal and civil penalties for unlawful payme.pdf
The FCPA established criminal and civil penalties for unlawful payme.pdfanokhilalmobile
 
The answer is(B.) H- and (C.) NH3Lewis bases are electron pair .pdf
The answer is(B.) H- and (C.) NH3Lewis bases are electron pair .pdfThe answer is(B.) H- and (C.) NH3Lewis bases are electron pair .pdf
The answer is(B.) H- and (C.) NH3Lewis bases are electron pair .pdfanokhilalmobile
 
Spontaneous mutation rates depend on the rate at which DNA transcrip.pdf
Spontaneous mutation rates depend on the rate at which DNA transcrip.pdfSpontaneous mutation rates depend on the rate at which DNA transcrip.pdf
Spontaneous mutation rates depend on the rate at which DNA transcrip.pdfanokhilalmobile
 
Sales revenue100000Less- COGS60000Gross profit40000Opera.pdf
Sales revenue100000Less- COGS60000Gross profit40000Opera.pdfSales revenue100000Less- COGS60000Gross profit40000Opera.pdf
Sales revenue100000Less- COGS60000Gross profit40000Opera.pdfanokhilalmobile
 
D) Counterclockwise answer .pdf
                     D) Counterclockwise answer                       .pdf                     D) Counterclockwise answer                       .pdf
D) Counterclockwise answer .pdfanokhilalmobile
 
Please give the differential equation and boundary conditions.So.pdf
Please give the differential equation and boundary conditions.So.pdfPlease give the differential equation and boundary conditions.So.pdf
Please give the differential equation and boundary conditions.So.pdfanokhilalmobile
 
Point.javapublic class Point {    int x,y;    double m,n; .pdf
Point.javapublic class Point {    int x,y;    double m,n; .pdfPoint.javapublic class Point {    int x,y;    double m,n; .pdf
Point.javapublic class Point {    int x,y;    double m,n; .pdfanokhilalmobile
 
pKa of H2PO4- is = 7.21According to Hendersons Equation ,pH = .pdf
pKa of H2PO4- is = 7.21According to Hendersons Equation ,pH = .pdfpKa of H2PO4- is = 7.21According to Hendersons Equation ,pH = .pdf
pKa of H2PO4- is = 7.21According to Hendersons Equation ,pH = .pdfanokhilalmobile
 
naphthalene, dry ice (solid co2),iodine(gentle heating), arsenic (At.pdf
naphthalene, dry ice (solid co2),iodine(gentle heating), arsenic (At.pdfnaphthalene, dry ice (solid co2),iodine(gentle heating), arsenic (At.pdf
naphthalene, dry ice (solid co2),iodine(gentle heating), arsenic (At.pdfanokhilalmobile
 

More from anokhilalmobile (20)

option E .Na2co3 hydrolysyes and gives NaoH which.pdf
                     option E .Na2co3 hydrolysyes and gives NaoH which.pdf                     option E .Na2co3 hydrolysyes and gives NaoH which.pdf
option E .Na2co3 hydrolysyes and gives NaoH which.pdf
 
non polar molecules such as lipids and cholestrol.pdf
                     non polar molecules such as lipids and cholestrol.pdf                     non polar molecules such as lipids and cholestrol.pdf
non polar molecules such as lipids and cholestrol.pdf
 
moles = molarity x volume = 4.25 molL x 2.50 L =.pdf
                     moles = molarity x volume = 4.25 molL x 2.50 L =.pdf                     moles = molarity x volume = 4.25 molL x 2.50 L =.pdf
moles = molarity x volume = 4.25 molL x 2.50 L =.pdf
 
Londondispersionvan der Waals forces - these ar.pdf
                     Londondispersionvan der Waals forces - these ar.pdf                     Londondispersionvan der Waals forces - these ar.pdf
Londondispersionvan der Waals forces - these ar.pdf
 
[H2SO4] = 0 because H2SO4 is a strong acid. first consider Ka2.pdf
[H2SO4] = 0 because H2SO4 is a strong acid. first consider Ka2.pdf[H2SO4] = 0 because H2SO4 is a strong acid. first consider Ka2.pdf
[H2SO4] = 0 because H2SO4 is a strong acid. first consider Ka2.pdf
 
You ordered a chest X-ray and saw fluid buildup in her right lung. S.pdf
You ordered a chest X-ray and saw fluid buildup in her right lung. S.pdfYou ordered a chest X-ray and saw fluid buildup in her right lung. S.pdf
You ordered a chest X-ray and saw fluid buildup in her right lung. S.pdf
 
why would you be the best candidate for the nursing programSTATEM.pdf
why would you be the best candidate for the nursing programSTATEM.pdfwhy would you be the best candidate for the nursing programSTATEM.pdf
why would you be the best candidate for the nursing programSTATEM.pdf
 
when the data value is passed between two different operating system.pdf
when the data value is passed between two different operating system.pdfwhen the data value is passed between two different operating system.pdf
when the data value is passed between two different operating system.pdf
 
Using mathematical induction,STEP 1The base n = 1 is clearl.pdf
Using mathematical induction,STEP 1The base n = 1 is clearl.pdfUsing mathematical induction,STEP 1The base n = 1 is clearl.pdf
Using mathematical induction,STEP 1The base n = 1 is clearl.pdf
 
The process include many steps which could be planning and preparati.pdf
The process include many steps which could be planning and preparati.pdfThe process include many steps which could be planning and preparati.pdf
The process include many steps which could be planning and preparati.pdf
 
The FCPA established criminal and civil penalties for unlawful payme.pdf
The FCPA established criminal and civil penalties for unlawful payme.pdfThe FCPA established criminal and civil penalties for unlawful payme.pdf
The FCPA established criminal and civil penalties for unlawful payme.pdf
 
The answer is(B.) H- and (C.) NH3Lewis bases are electron pair .pdf
The answer is(B.) H- and (C.) NH3Lewis bases are electron pair .pdfThe answer is(B.) H- and (C.) NH3Lewis bases are electron pair .pdf
The answer is(B.) H- and (C.) NH3Lewis bases are electron pair .pdf
 
Spontaneous mutation rates depend on the rate at which DNA transcrip.pdf
Spontaneous mutation rates depend on the rate at which DNA transcrip.pdfSpontaneous mutation rates depend on the rate at which DNA transcrip.pdf
Spontaneous mutation rates depend on the rate at which DNA transcrip.pdf
 
Sales revenue100000Less- COGS60000Gross profit40000Opera.pdf
Sales revenue100000Less- COGS60000Gross profit40000Opera.pdfSales revenue100000Less- COGS60000Gross profit40000Opera.pdf
Sales revenue100000Less- COGS60000Gross profit40000Opera.pdf
 
D) Counterclockwise answer .pdf
                     D) Counterclockwise answer                       .pdf                     D) Counterclockwise answer                       .pdf
D) Counterclockwise answer .pdf
 
Please give the differential equation and boundary conditions.So.pdf
Please give the differential equation and boundary conditions.So.pdfPlease give the differential equation and boundary conditions.So.pdf
Please give the differential equation and boundary conditions.So.pdf
 
Point.javapublic class Point {    int x,y;    double m,n; .pdf
Point.javapublic class Point {    int x,y;    double m,n; .pdfPoint.javapublic class Point {    int x,y;    double m,n; .pdf
Point.javapublic class Point {    int x,y;    double m,n; .pdf
 
pKa of H2PO4- is = 7.21According to Hendersons Equation ,pH = .pdf
pKa of H2PO4- is = 7.21According to Hendersons Equation ,pH = .pdfpKa of H2PO4- is = 7.21According to Hendersons Equation ,pH = .pdf
pKa of H2PO4- is = 7.21According to Hendersons Equation ,pH = .pdf
 
Covalent bonds .pdf
                     Covalent bonds                                   .pdf                     Covalent bonds                                   .pdf
Covalent bonds .pdf
 
naphthalene, dry ice (solid co2),iodine(gentle heating), arsenic (At.pdf
naphthalene, dry ice (solid co2),iodine(gentle heating), arsenic (At.pdfnaphthalene, dry ice (solid co2),iodine(gentle heating), arsenic (At.pdf
naphthalene, dry ice (solid co2),iodine(gentle heating), arsenic (At.pdf
 

Recently uploaded

UChicago CMSC 23320 - The Best Commit Messages of 2024
UChicago CMSC 23320 - The Best Commit Messages of 2024UChicago CMSC 23320 - The Best Commit Messages of 2024
UChicago CMSC 23320 - The Best Commit Messages of 2024Borja Sotomayor
 
Improved Approval Flow in Odoo 17 Studio App
Improved Approval Flow in Odoo 17 Studio AppImproved Approval Flow in Odoo 17 Studio App
Improved Approval Flow in Odoo 17 Studio AppCeline George
 
Stl Algorithms in C++ jjjjjjjjjjjjjjjjjj
Stl Algorithms in C++ jjjjjjjjjjjjjjjjjjStl Algorithms in C++ jjjjjjjjjjjjjjjjjj
Stl Algorithms in C++ jjjjjjjjjjjjjjjjjjMohammed Sikander
 
e-Sealing at EADTU by Kamakshi Rajagopal
e-Sealing at EADTU by Kamakshi Rajagopale-Sealing at EADTU by Kamakshi Rajagopal
e-Sealing at EADTU by Kamakshi RajagopalEADTU
 
Spellings Wk 4 and Wk 5 for Grade 4 at CAPS
Spellings Wk 4 and Wk 5 for Grade 4 at CAPSSpellings Wk 4 and Wk 5 for Grade 4 at CAPS
Spellings Wk 4 and Wk 5 for Grade 4 at CAPSAnaAcapella
 
How to Send Pro Forma Invoice to Your Customers in Odoo 17
How to Send Pro Forma Invoice to Your Customers in Odoo 17How to Send Pro Forma Invoice to Your Customers in Odoo 17
How to Send Pro Forma Invoice to Your Customers in Odoo 17Celine George
 
Andreas Schleicher presents at the launch of What does child empowerment mean...
Andreas Schleicher presents at the launch of What does child empowerment mean...Andreas Schleicher presents at the launch of What does child empowerment mean...
Andreas Schleicher presents at the launch of What does child empowerment mean...EduSkills OECD
 
FICTIONAL SALESMAN/SALESMAN SNSW 2024.pdf
FICTIONAL SALESMAN/SALESMAN SNSW 2024.pdfFICTIONAL SALESMAN/SALESMAN SNSW 2024.pdf
FICTIONAL SALESMAN/SALESMAN SNSW 2024.pdfPondicherry University
 
Đề tieng anh thpt 2024 danh cho cac ban hoc sinh
Đề tieng anh thpt 2024 danh cho cac ban hoc sinhĐề tieng anh thpt 2024 danh cho cac ban hoc sinh
Đề tieng anh thpt 2024 danh cho cac ban hoc sinhleson0603
 
Sternal Fractures & Dislocations - EMGuidewire Radiology Reading Room
Sternal Fractures & Dislocations - EMGuidewire Radiology Reading RoomSternal Fractures & Dislocations - EMGuidewire Radiology Reading Room
Sternal Fractures & Dislocations - EMGuidewire Radiology Reading RoomSean M. Fox
 
Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...
Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...
Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...EADTU
 
SURVEY I created for uni project research
SURVEY I created for uni project researchSURVEY I created for uni project research
SURVEY I created for uni project researchCaitlinCummins3
 
會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文
會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文
會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文中 央社
 
Observing-Correct-Grammar-in-Making-Definitions.pptx
Observing-Correct-Grammar-in-Making-Definitions.pptxObserving-Correct-Grammar-in-Making-Definitions.pptx
Observing-Correct-Grammar-in-Making-Definitions.pptxAdelaideRefugio
 
AIM of Education-Teachers Training-2024.ppt
AIM of Education-Teachers Training-2024.pptAIM of Education-Teachers Training-2024.ppt
AIM of Education-Teachers Training-2024.pptNishitharanjan Rout
 
An Overview of the Odoo 17 Knowledge App
An Overview of the Odoo 17 Knowledge AppAn Overview of the Odoo 17 Knowledge App
An Overview of the Odoo 17 Knowledge AppCeline George
 

Recently uploaded (20)

UChicago CMSC 23320 - The Best Commit Messages of 2024
UChicago CMSC 23320 - The Best Commit Messages of 2024UChicago CMSC 23320 - The Best Commit Messages of 2024
UChicago CMSC 23320 - The Best Commit Messages of 2024
 
Mattingly "AI and Prompt Design: LLMs with NER"
Mattingly "AI and Prompt Design: LLMs with NER"Mattingly "AI and Prompt Design: LLMs with NER"
Mattingly "AI and Prompt Design: LLMs with NER"
 
Improved Approval Flow in Odoo 17 Studio App
Improved Approval Flow in Odoo 17 Studio AppImproved Approval Flow in Odoo 17 Studio App
Improved Approval Flow in Odoo 17 Studio App
 
Mattingly "AI & Prompt Design: Named Entity Recognition"
Mattingly "AI & Prompt Design: Named Entity Recognition"Mattingly "AI & Prompt Design: Named Entity Recognition"
Mattingly "AI & Prompt Design: Named Entity Recognition"
 
Stl Algorithms in C++ jjjjjjjjjjjjjjjjjj
Stl Algorithms in C++ jjjjjjjjjjjjjjjjjjStl Algorithms in C++ jjjjjjjjjjjjjjjjjj
Stl Algorithms in C++ jjjjjjjjjjjjjjjjjj
 
e-Sealing at EADTU by Kamakshi Rajagopal
e-Sealing at EADTU by Kamakshi Rajagopale-Sealing at EADTU by Kamakshi Rajagopal
e-Sealing at EADTU by Kamakshi Rajagopal
 
Spellings Wk 4 and Wk 5 for Grade 4 at CAPS
Spellings Wk 4 and Wk 5 for Grade 4 at CAPSSpellings Wk 4 and Wk 5 for Grade 4 at CAPS
Spellings Wk 4 and Wk 5 for Grade 4 at CAPS
 
How to Send Pro Forma Invoice to Your Customers in Odoo 17
How to Send Pro Forma Invoice to Your Customers in Odoo 17How to Send Pro Forma Invoice to Your Customers in Odoo 17
How to Send Pro Forma Invoice to Your Customers in Odoo 17
 
Andreas Schleicher presents at the launch of What does child empowerment mean...
Andreas Schleicher presents at the launch of What does child empowerment mean...Andreas Schleicher presents at the launch of What does child empowerment mean...
Andreas Schleicher presents at the launch of What does child empowerment mean...
 
FICTIONAL SALESMAN/SALESMAN SNSW 2024.pdf
FICTIONAL SALESMAN/SALESMAN SNSW 2024.pdfFICTIONAL SALESMAN/SALESMAN SNSW 2024.pdf
FICTIONAL SALESMAN/SALESMAN SNSW 2024.pdf
 
Supporting Newcomer Multilingual Learners
Supporting Newcomer  Multilingual LearnersSupporting Newcomer  Multilingual Learners
Supporting Newcomer Multilingual Learners
 
Đề tieng anh thpt 2024 danh cho cac ban hoc sinh
Đề tieng anh thpt 2024 danh cho cac ban hoc sinhĐề tieng anh thpt 2024 danh cho cac ban hoc sinh
Đề tieng anh thpt 2024 danh cho cac ban hoc sinh
 
Sternal Fractures & Dislocations - EMGuidewire Radiology Reading Room
Sternal Fractures & Dislocations - EMGuidewire Radiology Reading RoomSternal Fractures & Dislocations - EMGuidewire Radiology Reading Room
Sternal Fractures & Dislocations - EMGuidewire Radiology Reading Room
 
OS-operating systems- ch05 (CPU Scheduling) ...
OS-operating systems- ch05 (CPU Scheduling) ...OS-operating systems- ch05 (CPU Scheduling) ...
OS-operating systems- ch05 (CPU Scheduling) ...
 
Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...
Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...
Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...
 
SURVEY I created for uni project research
SURVEY I created for uni project researchSURVEY I created for uni project research
SURVEY I created for uni project research
 
會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文
會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文
會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文
 
Observing-Correct-Grammar-in-Making-Definitions.pptx
Observing-Correct-Grammar-in-Making-Definitions.pptxObserving-Correct-Grammar-in-Making-Definitions.pptx
Observing-Correct-Grammar-in-Making-Definitions.pptx
 
AIM of Education-Teachers Training-2024.ppt
AIM of Education-Teachers Training-2024.pptAIM of Education-Teachers Training-2024.ppt
AIM of Education-Teachers Training-2024.ppt
 
An Overview of the Odoo 17 Knowledge App
An Overview of the Odoo 17 Knowledge AppAn Overview of the Odoo 17 Knowledge App
An Overview of the Odoo 17 Knowledge App
 

#include stdafx.h#include iostream#include Stringusing.pdf

  • 1. #include "stdafx.h" #include #include using namespace std; const int MAX_ARRAY_SIZE = 4; class memberType { public: string name; // Name of the person int id; // Member ID int n_books; // Number of books double amount; // Total amount spent public: memberType(); memberType(string ID, string first, string last, int books, double amount); // void setMemberInfo(string ID, string fName, string lName, int bPurchased, double amount); // member Name access methods void setMemberID(string); void setName(string, string); // set new name string getName(); // get Name bool isMemberID(string) const; int getBooksPurchased() const; double getTotalAmountSpent() const; void purchaseBook(double amount); void resetbooksBoughtAndAmount(); void printMemberID() const; void printName() const; void printInfo() const; private: string memberID; string firstName; string lastName; int booksPurchased; double amountSpent; };
  • 2. class bookType { public: void setTitle(string); //functions dealing with the title string getTitle(); bool compareTitle(string); //functions dealing with the copies of book void setCopies(int); void showCopies(); void updateCopies(int); int getCopies(); void setPublisher(string); //functions dealing with publisher of book void showPublisher(); void updatePublisher(string); string getPublisher(); void setISBN(string); //functions dealing with ISBN of book void showISBN(); void updateISBN(string); string getISBN(); bool compareISBN(string); void setPrice(double bookPrice); //functions dealing with price of book void showPrice(); void updatePrice(double compPrice); double getPrice(); void setAuthors(string); //functions dealing with author of book void showAuthors(); void updateAuthor(string compAuthor); string getAuthors(int i); //ith number of author will return bookType(); private: string title; string authors[4]; //objects of type bookType can contain up to 4 authors string publisher; string ISBN; double price; int copies;
  • 3. int authorsNo; }; bookType::bookType() { title = ""; for (int i = 0; i < 4; i++) authors[i] = ""; publisher = ""; ISBN = ""; price = 0; copies = 0; authorsNo = 0; } void bookType::setTitle(string myTitle) { title = myTitle; } string bookType::getTitle() { return title; } bool bookType::compareTitle(string otherTitle) { return (title.compare(otherTitle) == 0); } void bookType::setAuthors(string myAuthor) { authorsNo = authorsNo % 4; if (myAuthor.compare("") == 0) return; else { authors[authorsNo] = myAuthor; //store the author name authorsNo++; //keep track of authors count } }
  • 4. void bookType::showAuthors() { for (int i = 0; i < authorsNo; i++) cout << authors[i] << ", "; cout << " "; } void bookType::updateAuthor(string myAuthor) { setAuthors(myAuthor); } string bookType::getAuthors(int i) { return authors[i]; } void bookType::setCopies(int myCopies) { copies = myCopies; } void bookType::showCopies() { cout << " tThe number of copies " << copies; } void bookType::updateCopies(int myCopies) { copies = myCopies; } int bookType::getCopies() { return copies; } void bookType::setPublisher(string myPublisher) { publisher = myPublisher; } void bookType::showPublisher() {
  • 5. cout << publisher; } void bookType::updatePublisher(string myPublisher) { publisher = myPublisher; } string bookType::getPublisher() { return publisher; } void bookType::setISBN(string myISBN) { ISBN = myISBN; } void bookType::showISBN() { cout << ISBN; } void bookType::updateISBN(string myISBN) { ISBN = myISBN; } string bookType::getISBN() { return ISBN; } bool bookType::compareISBN(string myISBN) { return (myISBN.compare(myISBN)); } void bookType::setPrice(double myPrice) { price = myPrice; } void bookType::showPrice() {
  • 6. cout << " tThe book price is " << price; } void bookType::updatePrice(double myPrice) { price = myPrice; } double bookType::getPrice() { return price; } memberType::memberType() { memberID = ""; firstName = ""; lastName = ""; booksPurchased = 0; amountSpent = 0; } memberType::memberType(string ID, string first, string last, int books, double amount) { memberID = ID; firstName = first; lastName = last; booksPurchased = books; amountSpent = amount; } // member Name access methods void memberType::setMemberInfo(string ID, string fName, string lName, int bPurchased, double amount) { memberID = ID; firstName = fName; lastName = lName; booksPurchased = bPurchased; amountSpent = amount; }
  • 7. // member Id access methods void memberType::setMemberID(string id) { memberID = id; } void memberType::setName(string fName, string lName) { firstName = fName; lastName = lName; } bool memberType::isMemberID(string id) const { return memberID == id; } int memberType::getBooksPurchased() const { // get number of books return booksPurchased; } double memberType::getTotalAmountSpent() const { return amountSpent; } // Books methods void memberType::purchaseBook(double price) { amountSpent += price; // more money have been spent booksPurchased++; // and more books has been aquired } void memberType::resetbooksBoughtAndAmount() { amountSpent = 0; booksPurchased = 0; } void memberType::printMemberID() const { cout << memberID;
  • 8. } void memberType::printName() const { cout << firstName << " " << lastName; } void memberType::printInfo() const { printMemberID(); cout << endl; printName(); cout << endl; cout << booksPurchased << endl; cout << amountSpent << endl; } void showChoices(); int main() { int choice; // holds the selection do { showChoices(); cin >> choice; cout << endl; switch (choice) { case 'a': break; case 'b': break; default: void memberType::printInfo() const; ///*default: // cout << "Invalid input." << endl; //}*/ } while (choice != 99); } void showChoices() {
  • 9. cout << "Enter--" << endl; cout << "1: MemberInfo:" << endl; cout << "2: Number of books purchased:" << endl; cout << "3: Spent Amount: " << endl; cout << "99:To quit the program." << endl; } Solution #include "stdafx.h" #include #include using namespace std; const int MAX_ARRAY_SIZE = 4; class memberType { public: string name; // Name of the person int id; // Member ID int n_books; // Number of books double amount; // Total amount spent public: memberType(); memberType(string ID, string first, string last, int books, double amount); // void setMemberInfo(string ID, string fName, string lName, int bPurchased, double amount); // member Name access methods void setMemberID(string); void setName(string, string); // set new name string getName(); // get Name bool isMemberID(string) const; int getBooksPurchased() const; double getTotalAmountSpent() const; void purchaseBook(double amount); void resetbooksBoughtAndAmount(); void printMemberID() const; void printName() const;
  • 10. void printInfo() const; private: string memberID; string firstName; string lastName; int booksPurchased; double amountSpent; }; class bookType { public: void setTitle(string); //functions dealing with the title string getTitle(); bool compareTitle(string); //functions dealing with the copies of book void setCopies(int); void showCopies(); void updateCopies(int); int getCopies(); void setPublisher(string); //functions dealing with publisher of book void showPublisher(); void updatePublisher(string); string getPublisher(); void setISBN(string); //functions dealing with ISBN of book void showISBN(); void updateISBN(string); string getISBN(); bool compareISBN(string); void setPrice(double bookPrice); //functions dealing with price of book void showPrice(); void updatePrice(double compPrice); double getPrice(); void setAuthors(string); //functions dealing with author of book void showAuthors(); void updateAuthor(string compAuthor); string getAuthors(int i); //ith number of author will return
  • 11. bookType(); private: string title; string authors[4]; //objects of type bookType can contain up to 4 authors string publisher; string ISBN; double price; int copies; int authorsNo; }; bookType::bookType() { title = ""; for (int i = 0; i < 4; i++) authors[i] = ""; publisher = ""; ISBN = ""; price = 0; copies = 0; authorsNo = 0; } void bookType::setTitle(string myTitle) { title = myTitle; } string bookType::getTitle() { return title; } bool bookType::compareTitle(string otherTitle) { return (title.compare(otherTitle) == 0); } void bookType::setAuthors(string myAuthor) { authorsNo = authorsNo % 4;
  • 12. if (myAuthor.compare("") == 0) return; else { authors[authorsNo] = myAuthor; //store the author name authorsNo++; //keep track of authors count } } void bookType::showAuthors() { for (int i = 0; i < authorsNo; i++) cout << authors[i] << ", "; cout << " "; } void bookType::updateAuthor(string myAuthor) { setAuthors(myAuthor); } string bookType::getAuthors(int i) { return authors[i]; } void bookType::setCopies(int myCopies) { copies = myCopies; } void bookType::showCopies() { cout << " tThe number of copies " << copies; } void bookType::updateCopies(int myCopies) { copies = myCopies; } int bookType::getCopies() {
  • 13. return copies; } void bookType::setPublisher(string myPublisher) { publisher = myPublisher; } void bookType::showPublisher() { cout << publisher; } void bookType::updatePublisher(string myPublisher) { publisher = myPublisher; } string bookType::getPublisher() { return publisher; } void bookType::setISBN(string myISBN) { ISBN = myISBN; } void bookType::showISBN() { cout << ISBN; } void bookType::updateISBN(string myISBN) { ISBN = myISBN; } string bookType::getISBN() { return ISBN; } bool bookType::compareISBN(string myISBN) {
  • 14. return (myISBN.compare(myISBN)); } void bookType::setPrice(double myPrice) { price = myPrice; } void bookType::showPrice() { cout << " tThe book price is " << price; } void bookType::updatePrice(double myPrice) { price = myPrice; } double bookType::getPrice() { return price; } memberType::memberType() { memberID = ""; firstName = ""; lastName = ""; booksPurchased = 0; amountSpent = 0; } memberType::memberType(string ID, string first, string last, int books, double amount) { memberID = ID; firstName = first; lastName = last; booksPurchased = books; amountSpent = amount; } // member Name access methods void memberType::setMemberInfo(string ID, string fName, string lName, int bPurchased,
  • 15. double amount) { memberID = ID; firstName = fName; lastName = lName; booksPurchased = bPurchased; amountSpent = amount; } // member Id access methods void memberType::setMemberID(string id) { memberID = id; } void memberType::setName(string fName, string lName) { firstName = fName; lastName = lName; } bool memberType::isMemberID(string id) const { return memberID == id; } int memberType::getBooksPurchased() const { // get number of books return booksPurchased; } double memberType::getTotalAmountSpent() const { return amountSpent; } // Books methods void memberType::purchaseBook(double price) { amountSpent += price; // more money have been spent booksPurchased++; // and more books has been aquired }
  • 16. void memberType::resetbooksBoughtAndAmount() { amountSpent = 0; booksPurchased = 0; } void memberType::printMemberID() const { cout << memberID; } void memberType::printName() const { cout << firstName << " " << lastName; } void memberType::printInfo() const { printMemberID(); cout << endl; printName(); cout << endl; cout << booksPurchased << endl; cout << amountSpent << endl; } void showChoices(); int main() { int choice; // holds the selection do { showChoices(); cin >> choice; cout << endl; switch (choice) { case 'a': break; case 'b': break; default:
  • 17. void memberType::printInfo() const; ///*default: // cout << "Invalid input." << endl; //}*/ } while (choice != 99); } void showChoices() { cout << "Enter--" << endl; cout << "1: MemberInfo:" << endl; cout << "2: Number of books purchased:" << endl; cout << "3: Spent Amount: " << endl; cout << "99:To quit the program." << endl; }