Ask Question
12 July, 02:45

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. 12 July, 03:02
    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 & Technology if the answers seem to be not correct or there’s no answer. Try a smart search to find answers to similar questions.
Search for Other Answers