[Solved]Lab 642 Interfaces Virtual Functions Part 2 Objectives Familarire Student Implemanting Int Q37109113

the second picture is the rest of the question please solve inc++Lab 6.4.2 Interfaces and virtual functions: part 2 Objectives Familarire the student with: implemanting interfaces according to spec ific ations * polymorphism, or using objects of diffarent typas through a common into face Scenario Now that we have a basic valikator interfae ready, we can practice using the interface Create the following vaidator classe MinLength Valbdator, which will consider a string valid only if i’s longer than the required minimum; MaxLength Valilator, which will consider a string vald only if it’s shorter than the required maximum Pattern Vabdator, which will consilar a string vaid only if at least part of the string matches the supplied pattan. To remind you, hare are the rukes we defined carliar ragarding patterns: o a patt ern will consist of non-whitespace characters the letter ‘D’ will match any decimal dig, sothe pattern “DDDD” will match for strings “1234 2309″ etc · the letter’A’ will match any character of the Engli h alphabet (upper and lower case), so the pattern AAA” wil match for strings “CAT “dog”, “ToC” etc. ๒war-case letters in a pattern will miatchiKcording letīrs of the English alphabet, so the pattern “cat” will match for strings Cat”, “cat” CAT, etc . · The character .?’ will match every character、mchading whaespace, so the pattern “a7b” will match for strings “A+B”, b “Acb”, “a B”, etc Any punctuaton excep17 will rnach exactly the same punctuaton in a string, so the patt ส n AA DDD” will match for strings “NE-785 “am-236”, etc #1nclude <iostream> #include <string class Stringvalidator public: virtual -Stringvalidator) virtual bool isvalid(std:sstring input) // Write your code here class DumnyValidator: public StringValidator public: virtual bool isvalid(std::string input); h: bool DummyVa1idator::isvalid(std::string input) return true; using namespace std void printValid(StringValidator “validator, string input) cout < “The stringinput <is e (validator.isValid(“hello”)? “valid” “invalid”) int main() DummyValidator dummy printValid (dummy, “hello”) cout < endl; ExactValidator exact(“secret) printValid (exact, “hello”) printValid(exact, “secret return 0 Example output The string hello’ is valid The string hello is invalid The string secret’ is valid Show transcribed image text Lab 6.4.2 Interfaces and virtual functions: part 2 Objectives Familarire the student with: implemanting interfaces according to spec ific ations * polymorphism, or using objects of diffarent typas through a common into face Scenario Now that we have a basic valikator interfae ready, we can practice using the interface Create the following vaidator classe MinLength Valbdator, which will consider a string valid only if i’s longer than the required minimum; MaxLength Valilator, which will consider a string vald only if it’s shorter than the required maximum Pattern Vabdator, which will consilar a string vaid only if at least part of the string matches the supplied pattan. To remind you, hare are the rukes we defined carliar ragarding patterns: o a patt ern will consist of non-whitespace characters the letter ‘D’ will match any decimal dig, sothe pattern “DDDD” will match for strings “1234 2309″ etc · the letter’A’ will match any character of the Engli h alphabet (upper and lower case), so the pattern AAA” wil match for strings “CAT “dog”, “ToC” etc. ๒war-case letters in a pattern will miatchiKcording letīrs of the English alphabet, so the pattern “cat” will match for strings Cat”, “cat” CAT, etc . · The character .?’ will match every character、mchading whaespace, so the pattern “a7b” will match for strings “A+B”, b “Acb”, “a B”, etc Any punctuaton excep17 will rnach exactly the same punctuaton in a string, so the patt ส n AA DDD” will match for strings “NE-785 “am-236”, etc
#1nclude #include
Expert Answer
Answer to Lab 6.4.2 Interfaces and virtual functions: part 2 Objectives Familarire the student with: implemanting interfaces accor… . . .
OR

