Ask Question
8 July, 03:10

Write a program having a concrete subclass that inherits three abstract methods from a superclass. Provide the following three implementations in the subclass corresponding to the abstract methods in the superclass:

1. Check for uppercase characters in a string, and return true or false' depending on if any are found.

2. Convert all of the lower case characters to uppercase in the input string, and return the result.

3. Convert the input string to integer and add 10, output the result to the console.

Create an appropriate class having a main method to test the above setup.

+1
Answers (1)
  1. 8 July, 03:17
    0
    C++

    Explanation:

    using namespace std;

    class AbstractClass {

    public:

    virtual bool checkUpperCase (string inputString);

    virtual string lowerToUppercase (string inputString);

    virtual void stringToInt (string inputString);

    };

    class ConcreteClass: public AbstractClass {

    public:

    bool checkUpperCase (string inputString) {

    bool isUpper = false;

    for (int i=0; i < strlen (inputString); i++) {

    if (isupper (inputString[i])) {

    isUpper = true;

    break;

    }

    return isUpper;

    }

    string lowerToUppercase (string inputString) {

    for (int i=0; i < strlen (inputString); i++) {

    putchar (toupper (inputString[i]));

    }

    return inputString;

    }

    void stringToInt (string inputString) {

    int convertedInteger = stoi (inputString);

    convertedInteger+=10;

    cout<
    }

    };

    int main () {

    ConcreteClass cc;

    return 0;

    }
Know the Answer?
Not Sure About the Answer?
Get an answer to your question ✅ “Write a program having a concrete subclass that inherits three abstract methods from a superclass. Provide the following three ...” in 📙 Computers & Technology if there is no answer or all answers are wrong, use a search bar and try to find the answer among similar questions.
Search for Other Answers