Question: OOPS WITH DESIGN PATTERNS General Instructions: In this assignment you will be implementing a 'License Key Formatter' in an object-oriented manner. This program would involve

 OOPS WITH DESIGN PATTERNS General Instructions: In this assignment you will

OOPS WITH DESIGN PATTERNS

General Instructions: In this assignment you will be implementing a 'License Key Formatter' in an object-oriented manner. This program would involve some basic manipulation of strings and reading from/writing to files. The driver program is given to you and you are NOT allowed to change it. Hence, the obvious overloaded operators will be those for input and output which need to be implemented. Specific Instructions: This assignment should be written as a modular C++ program. You will develop a class (module) called KeyFormatter, with header (.h) and implementation (.cpp) files. The main program should be in its own module, and it is given to you. In this program, an input file with license keys is provided and you need to use the algorithm provided in the next section to format the provided keys and print the output in a file. Programming concepts that are expected in the solution: 1. Object oriented modular solution 2. File 10 operation 3. Use of operator overloading 4. Use of friend function License Key Formatter Algorithm: You are given a string S that consists of only alphanumeric characters and dashes, and an integer K. You will first remove the dashes from the input string and then insert dashes at appropriate intervals to divide the string into groups. Each group should contain exactly K characters, except for the first group, which could be shorter than K but still must contain at least one character. Furthermore, you should convert all lowercase letters to uppercase. Example 1: Input: S= "5F3Z-2e-9-w", K=4 Output: "5F3Z-2E9W" Explanation: Remove the dashes from string S as "5F3Z2e9w"; then divide it into groups of 4 separated by dashes as in "5F3Z-2e9w" and then all lowercase converted to uppercase i.e., "5F3Z2E9W

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!