Question: write full program in oop c++ and divide in section like below // (green headings) write full program in c++ and divide in section like

write full program in oop c++ and divide in section like below // (green headings)

write full program in oop c++ and divide in section like below

// (green headings) write full program in c++ and divide in section

write full program in c++ and divide in section like above // (green headings)

Task 2: Create a class Class1 with a string data member 'paragraph'. Provide a constructor and getParagraph() method in the class. The constructor just assigns NULL to the data member. getParagraph() method must read a paragraph from user. The paragraph should contain at least 30 words. If there are less than 20 words, the program must ask user to enter paragraph again. Create another class Class2, and make it a friend of the class Class1. Provide a function getSubString(Class1 &obj1, int startIndex, int lastIndex) with return type string in the class Class 2 which accepts an object of class Class1 (by reference) and two integers. The getSubString() function should return the substring starting from location startIndex and ending at location lastIndex. Class2 must also contain a store() function that stores the substring in a file. Print screenshot of substring stored in file as well. (Topics covered: File Handling, Friend Classes; Estimated Completion Time: 45 minutes; Marks: 10) Sample Main() program: int main() { Class1 obj1; obj1.getParagraph();//reads paragraph like This is question 2 of final Exam. In this question the students are required to perform file handling and use friend classes" Class2 obj2; string substring = obj2.getSubString(&obj1, 5, 15); //stores the substring starting at location 5 and ending at location 15 which is final Exam. In this question the students are required to " in paragraph. obj2.store(substring); // stores substring in file return 0; } l/Print class Class1 with constructors, data member and member functions here 1/Print Class2 here // Print main function here 1/Print Output showing scenario when user didn't enter a paragraph of at least 20 words Print rest of the screenshots here 1/Print output of file here

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 Databases Questions!