In this exercise, you will design a class memberType.
a. Each object of memberType can hold the name of a person, member ID, number of books bought, and amount spent.
b. Include the member functions to perform the various operations on the objects of memberType—for example, modify, set, and show a person's name. Similarly, update, modify, and show the number of books bought and the amount spent.
c. Add the appropriate constructors.
d. Write the definitions of the member functions of memberType.
e. Write a program to test various operations of your class memberType.
This is what I have so far, not sure if fulfill all the assignment required.
#include<iostream>
#include<string>
using namespace std;
class memberType
public: void set(string name, string id, int no, float a);
void modify(string name);
void modify(int no, float a);
void show();
};
void memberType::set(string n, string id, int no, float a)
{
Name=n;
ID=id;
no_books=no;
amount=a;
}
void memberType::modify(string name)
{
Name=name;
}
void memberType::modify(int no, float a)
{
no_books=no;
amount=a;
}
void memberType::show()
{
cout<<"Person's Name is: "<<Name<<endl;
cout<<"Person's ID is: "<<ID<<endl;
cout<<"Number of Books is: "<<no_books<<endl;
cout<<"Amount Spent is: "<<amount<<endl;
}
[Session started at 2014-10-06 20:51:53 +0300.]
WELCOME TO PALOMA'S BOOK STORE
ENTER LIBRARY MEMBER'S NAME: Phillip
ENTER LIBRARY MEMBER'S ID: 3278
ENTER NUMBER OF BOOKS BOUGHT: 2
ENTER DOLLAR AMOUNT PER BOOK: 5
Person's Name is: Phillip
Person's ID is: 3278
Number of Books is: 2
Amount Spent is: 5
ENTER UPDATED NAME: