i need help to make this program please help me Problem Statement: Write a program using class(constructor, destructor, other member functions) to find the frequency of letters (small and capital alphabet or digit) from your student id character string. For example, frequency of letter ‘4’ in the string of a student id: “MC124514517” is 2. Detailed Description: You are required to write a program which contains a class myClass having the following data members: char*str, alphabet; and the following member functions: • myClass(); • void setId(char *); • char * getId(); • void countfunction(); • ~myClass(); The main() function should create an object of myClass and through this object member functions are called one by one. When the object is created then constructor of myClass should dynamically allocate the memory using new operator for your VUID and displays a message after storing the default id in data member character pointer str. “Default Constructor is called and default id is MC123456789” Similarly, setId() member function when called with your VUID passed as parameter, should set the value of data member character pointer str with your VUID. getId() function should return the value of data member character pointer str to the main(), then following message with your VUID should be displayed: “Your ID is MC120403765” Finally countfunction() must get input (any alphabet) from user by displaying the message, “Enter letter you want to count:” Then this function counts frequency of the specified letter from your VUID and displays it. Destructor at the end of the program should be called and display message: “Destructor called… and object has destroyed”
All 5 Replies
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.