Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 2 of 2

Thread: HOW to go about this program

  1. #1
    Junior Member
    Join Date
    Mar 2011
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default HOW to go about this program

    Program specification:

    Write a Java program that contains a main() method with code that does the following:
    Has final data storage for a character with the value 'r'. (This is the "secret" letter.)
    Allows the the user to enter a word (their guess), and accepts the user's entry; when the user enters "stop" the program ends.
    When a word other than "stop" is entered, the user sees a message telling them whether or not their guess contained the secret letter and is asked for their next guess.
    Sample output: (user's entry in bold)
    enter your word, stop to end.
    hello
    Your guess does not contain the secret letter
    enter next word, stop to end.
    frog
    Your guess contains the secret letter
    enter next word, stop to end.
    stop

    I'm not sure how to go about making R the secret letter, any help would be greatly appreciated.

    Thanks

    Creeeds


  2. #2
    Grand Poobah
    Join Date
    Mar 2011
    Posts
    1,545
    My Mood
    Grumpy
    Thanks
    0
    Thanked 167 Times in 158 Posts

    Default Re: HOW to go about this program

    "final data storage for a character with the value 'r'. "

    Your instructions basically tell you. Do you know how to declare a variable? Do you know how to make the type of the variable be a character? Do you know how to make that variable final(constant)? Do you know how to assign a value to that variable? I am fairly sure the answer to all those questions is yes. Therefore you know how to do this.

Similar Threads

  1. Help with class program!!! STUCK! Program not doing what I Want!!!
    By sketch_flygirl in forum What's Wrong With My Code?
    Replies: 7
    Last Post: April 4th, 2011, 07:29 AM