Defining a protected method with a single call. Failing verification and I can't figure out why
Hey all,
I'm making my way through a beginner tutorial at dotnetacademy and I'm at the final exam for the beginner level. I'm getting an error when I try to verify my submission centered around my definition of the
PrintQuestion
method and I can't figure out what I'm doing wrong. The error I'm getting back when I try to verify my answer reads:
Not all requirements have been met. In your Question class, your 'PrintQuestion' method must have a single Console.WriteLine invocation passing the Label property as the only argument....but I do define a PrintQuestion method and it does have a single Console.WriteLine invocation passing the label property as its only property. [part 1/3]
2 Replies
My submission is below and the instructions are below that, with the relevant paragraph in bold. I'm sure I'm missing something basic, can you help train my beginner eye and point me to where I'm going wrong? Thank you!
My Submission
[part 2/3]
Instructions
Please define a public class named Question. This class should be abstract as it will be inherited by other classes. The Question class should have an automatic public property called Label which should be a string. The Label property must have both a getter and a setter.
The Question class should define a protected method named CreateAnswer that has a single string parameter. This method should be abstract so should not have an implementation within this class. The method must return an instance of Answer. The input parameter must be named input and represents the user's response from the question.
The Question class should define a protected method named PrintQuestion that by default will write Label property value to the Console using WriteLine. It must be possible to override this method in any inherited classes.
The Question class should also define a public method named Ask which will first print the question. It will then collect the next line from Console using ReadLine and create an answer by returning the value of the CreateAnswer method, using the collected input.
The answer must then be returned as the return value of the Ask method.
[part 3/3]
maybe it expect the Ask() method to call PrintQuestion instead of Console.WriteLine