Question: Chapter 10, End of Chapter, PROGRAMMING EXERCISES,Exercise 13 In this exercise, you will design a class memberType. a. Each object of memberType can hold the

Chapter 10, End of Chapter, PROGRAMMING EXERCISES,Exercise 13

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 memberTypefor 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.

I need your help to create three files memberType.cpp, main.cpp, and memberType.h from the question above and make sure compile and execute

Explanation

Answer

#include using namespace std; class memberType { string name; int id,numBooksBought; double amountSpent; public: memberType(string n, int i, int no, double amt) { name=n; id=i; numBooksBought=no; amountSpent=amt; } void setName(string n) { name=n; } string getName() { return name; } void setID(int i) { id=i; } int getID() { return id; } void setNumberBooksBought(int no) { numBooksBought=no; } int getNumberBooksBought() { return numBooksBought; } void setAmountSpent(double amt) { amountSpent=amt; } double getAmountSpent() { return amountSpent; } }; int main() { memberType m("Pravin",101,15,225.50); cout<<"Name: "<endl; cout<<"ID: "<endl; cout<<"Number of Books bought: "<endl; cout<<"Amount spent: $"<endl; return 0; 

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!