Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialJohannes Thuesen
956 PointsConsole I/O task 2/2 I can't see what's wrong with my answer.
The task is: Use the System.Console.ReadLine method to read the userโs response from the console and store it in a variable named bookTitle.
And my answer is: string BookTitle = System.Console.ReadLine();
I can't see what I have done wrong.
4 Answers
andren
28,558 PointsWhen you do challenges with multiple parts you have to keep the code from the previous parts in order to succeed. The first task in the Console I/O challenge asked you to use System.Console.Write to prompt a user for their favorite book, since you removed that code the challenge will fail even if your code passes the second task.
Additionally the variable name being asked for "bookTitle" and the one you used "BookTitle" are not the same.
When you do challenges most variable names has to match exactly with the names that the challenge asks for, and variable names like most things in programming are case sensitive.
So you need to add the solution to the first task back to your code and fix the capitalization of your variable name, so that it looks like this:
System.Console.Write("Enter a book title: ");
string bookTitle = System.Console.ReadLine();
Edit: This answer was edited to merge my original answer and my later comment down below together, due to the fact that my original answer on its own seems to have caused some confusion.
Johannes Thuesen
956 PointsThank you very much :)
steeve Francois
Courses Plus Student 572 PointsI do not understand I tried what andren said is the answer it did not work
Edward CINTRON
5,254 Pointsdidn't work with 'string', used 'var' instead and it worked
Johannes Thuesen
956 PointsJohannes Thuesen
956 PointsI have wrote bookTitle, and it says: Bummer! Are you calling the 'Write()' method as specified in the instructions?
andren
28,558 Pointsandren
28,558 PointsWhen you do challenges with multiple parts you have to keep the code from the previous parts in order to succeed, the first task in the Console I/O challenge asked you to use System.Console.Write to prompt a user for their favorite book, since you removed that code the challenge now fails even though your code passes the second task.
So you need to add the solution to the first task back to your code so that it looks like this:
Brianna Ingram
642 PointsBrianna Ingram
642 PointsI understand up until this point, but I am having trouble with the next task: "Use the System.Console.ReadLine method to read the userโs response from the console and store it in a variable named bookTitle." My only clue is : "Enter a book title.".