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 trial

Java

What does "prompt for the story template" mean?

// TODO:csd - Instantiate a new Prompter object and prompt for the story template

Instantiate a new Prompter object: I understand how to do this:

Prompter prompter = new Prompter();

Prompt for the story template. What is this asking me to do?

i.e. In math when someone says: "1 and 1" I know they are saying to 'add'. "1 from 1" I know they are saying to 'subtract'.

SOOO...

In java when someone says: "prompt for x", what are they saying to do?

To pass something in, you place it between the () of the method call; however, I don't think this is the right thing here, is it?

All I can think of is to do a 'System.out.print' asking for the template; but this will not look for input.

The term 'read line' keeps popping in my head but I can't seem to place how to use it.

5 Answers

Update:

I found another website: http://codingbat.com/ that has been very encouraging to me. It lets me practice basic java coding methods and easily see how it is done when I don't know. Another good learning source along with Treehouse.

Been doing basic java method exercises for the last couple hours. This has helped me to structure my method language skills and given me a much needed boost in morale.

Andrew Winkler
Andrew Winkler
37,739 Points

You're not any less agile. I'm fresh out of college and these directions are vague. I do highly respect the Craig and the moderators, but it seams like a lot of the learners are having trouble picking up on the high context terminology in this lesson.

I did eventually solve the challenge though. So lemme break down the first TODO:

// TODO:csd - Instantiate a new Prompter object and prompt for the story template

To be clear, instantiation is the process of creating a new object from a class definition. Prompter() is defined in Prompter.java. So lets create a new prompter like the Java Gods we are:

Prompter prompter = new Prompter();

Well, now the task is half done, but we still need to "prompt for the story template" -- this is where it gets confusing because 'prompt' in this context is not a java term, rather it the action that the prompter object does with data (in coorelation a 'boxer' object would 'box' data in a java program). The prompter object we instantiated is incomplete in that it's not gonna do anything until we feed/give it a story. So let's give it a story and let it do it's job (study prompter.class to understand). **Note that Craig said "We've been prompting using readLine." So let's feed the prompter a story in a line. (cuz apparently prompter's love cocaine. lolz :))

You can accomplish feeding the prompter a line various ways, but I opted to simply replace the String story = prompter.createStory();

with

System.out.printf("%nWrite your story here mark word class for the story with surrounding it with __ (example: __name__) to be filled:%n");.

It just simplified things in my mind. Anyways that concludes the first TODO: how to.

Craig Dennis
STAFF
Craig Dennis
Treehouse Teacher

We've been prompting using readLine.

That hint help?

Even though Craig is gone and it's three years since this post was made, I went through all prereqs and still find this difficult to understand. I think it's a problem with my understanding of what to do next based on the verbiage. I need it spelled out like make a new object then you will pass in a stary template.

I agree. 'Prompt for the story template' is too vague for someone to understand what they are meant to do. I've done the entire Beginner Java track and I'm in the middle of Java Intermediate - I haven't skipped any exercises... and this still has me stumped. I still don't understand what it is asking for.

it helps a bit... but feeling way out of my league. maybe i need to take more remedial Java courses for awhile until I can see how things fit together better.

I created a getter for the private mReader object then was able to call in Main prompter.getReader(); but that didn't do much.

Craig Dennis
Craig Dennis
Treehouse Teacher

Oh have you not taken the earlier courses?

I have taken the java courses sequentially but perhaps at 40 my mind is not as agile and I am having trouble putting all the ideas together.

Craig Dennis
Craig Dennis
Treehouse Teacher

Oh sorry, I was just wondering about the "more remedial courses", I thought maybe you hadn't taken the prerequisites.

Getting anywhere with this one?