Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Financial management theory and practice

Authors: Eugene F. Brigham and Michael C. Ehrhardt

12th Edition

978-0030243998, 30243998, 324422695, 978-0324422696

Students also viewed these Programming questions

Question

4 Sample design.

Answered: 1 week ago