Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

image text in transcribed

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

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

Students also viewed these Databases questions