Ask Question
8 June, 06:18

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.

+3
Answers (1)
  1. 8 June, 08:25
    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?
Find 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 and Technology if you're in doubt about the correctness of the answers or there's no answer, then try to use the smart search and find answers to the similar questions.
Search for Other Answers