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 8 of 8

Thread: Translation Game

  1. #1
    Junior Member
    Join Date
    Dec 2013
    Posts
    24
    Thanks
    6
    Thanked 0 Times in 0 Posts

    Default Translation Game

    Hi everybody I'm new to java programming and our teacher gave us the following project.
    I don't know where nor how to start. I appreciate your help.
    The project is :

    The project is to develop the game Translate the Word .... It is asking user to translate a word proposed to and check if the input response is correct. At the end of the game score will be calculated and displayed.
    Game Play :
    1 - Ask the user to specify , through the console , its name and the number of words to offer . It is up to you to handle exceptions (eg number of words greater than the number you provided )
    2 - Recover user response ( the word translated ) and check whether to continue . (eg you want to continue (y / n)) after each proposal.
    3 - compare the response of the user with that which is preset for the word in question .
    4 - Show the score at the end ( or at the breakpoint ) .
    5 - Save the file in a user name , the score , the number of questions and the start date and end of the game played .
    Some notes to consider :
    1 - The language (eg, English - French , English - Arabic , etc. . ): It is up to you to specify the language adopted in the game and inform the user of your choice.
    2 - The word bank to offer : It is up to you to develop the appropriate means to get the words to propose to the user. That said , the words and their translations can be retrieved :
    a. a TXT file
    b . an XML file . ( Tutorials DOM and SAX )
    c . CSV file ( OpenCSV Tutorial )
    d. a database ( Tutorial Access)
    e . through APIs (eg Wordnet and google translate etc . ) .
    f . a combination of the previous options a, bc , d and / or e . (eg words stored in a txt file and answers retrieved from the api google translate)
    g . etc. .
    Examples of files and databases are attached to the project statement . You will need to add one or more external libraries to your project. Click here for details on adding external libraries to Netbeans .
    3 - A user will be associated with the question score if he can translate the word correctly. The score for each question can be calculated based on the number of words / questions to be proposed .
    development
    In this project you will need at least :
    a class called Question to encapsulate the word and its translations and provide all necessary methods to manipulate the object type Question.
    an interface called IParser to make extensible project. Any class that implements IParser is a parser file (XML , TXT , CSV , etc.). / Database. In your project there will be a single class that implements IParser and will be used to retrieve words and their translations
    bonus
    Add the ability to store the questions and answers of the user on the hard disk. Make the class Serializable Question


  2. #2
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,042
    Thanks
    63
    Thanked 2,708 Times in 2,658 Posts

    Default Re: Translation Game

    Start by making a list of the steps the program must do to do the task. Start at the first step in the list, code it, compile and test the program. When it works move to the second step.
    The first steps looks like:
    1) Ask the user to specify , through the console , its name
    2) Ask the user to specify , through the console , the number of words to offer
    ...

    When you have problems with a step, post a description of the step, post the code and your questions about the problems you are having with the step.
    If you don't understand my answer, don't ignore it, ask a question.

  3. #3
    Junior Member
    Join Date
    Dec 2013
    Posts
    24
    Thanks
    6
    Thanked 0 Times in 0 Posts

    Default Re: Translation Game

    I did the name the number of words. but I'm finding a difficulty in class Question and Interface IParser. I'm confused. I know that i need a ArrayList but how to link them both (The class and interface)
    And the loop While how I can use it

  4. #4
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,042
    Thanks
    63
    Thanked 2,708 Times in 2,658 Posts

    Default Re: Translation Game

    the loop While how I can use it
    What is to be done in the while loop? What will control when the loop starts and end?

    see the tutorial for interfaces:
    http://docs.oracle.com/javase/tutori...interface.html
    http://docs.oracle.com/javase/tutori...interface.html

    Implementing an interface gives a class a data type. Generic ArrayLists require that its contents be of one data type.
      ArrayList<TheInterfaceName> anAL = new ArrayList<>(); // define AL to hold objects of type: TheIntefaceName
    If you don't understand my answer, don't ignore it, ask a question.

  5. The Following User Says Thank You to Norm For This Useful Post:

    e93 (December 21st, 2013)

  6. #5
    Junior Member
    Join Date
    Dec 2013
    Posts
    24
    Thanks
    6
    Thanked 0 Times in 0 Posts

    Default Re: Translation Game

    I want to use the loop for the number of words given by the person.
    The words I need to link are in a text file
    if I put like 50 words in this text file and the person gave me 100 words, I have to use a loop in main right?

    And how can i read a text file that has multiple lines in it
    i can use buffered reader, but how can i go to the second line an so

  7. #6
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,042
    Thanks
    63
    Thanked 2,708 Times in 2,658 Posts

    Default Re: Translation Game

    If want to use the number of items in a list to control how many times to go around a loop, you should use a for loop.
    What will the code inside the loop do?

    The loop does not need to be in the main() method. In fact it should probably be in another method where a specific task is being done. For example: searching for a match in a list and returning the index to where the match was found.
    If you don't understand my answer, don't ignore it, ask a question.

  8. #7
    Junior Member
    Join Date
    Apr 2014
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: Translation Game

    hi.
    can i please have a complete code for this game.
    thanks..

  9. #8
    Super Moderator
    Join Date
    Jun 2013
    Location
    So. Maryland, USA
    Posts
    5,520
    My Mood
    Mellow
    Thanks
    215
    Thanked 698 Times in 680 Posts

    Default Re: Translation Game

    Welcome to the Forum! Please read this topic to learn how to post code correctly and other useful tips for newcomers.

    Probably not. If you're working on a similar project, post your code and ask questions you have about your work.

Similar Threads

  1. TRANSLATION NEEDED
    By Uchihamontana in forum What's Wrong With My Code?
    Replies: 8
    Last Post: December 2nd, 2013, 10:13 AM
  2. java gui for translation/as dictionary
    By malayo in forum Java Theory & Questions
    Replies: 1
    Last Post: September 2nd, 2013, 12:59 AM
  3. Translation to Java?
    By java_novice in forum Java Theory & Questions
    Replies: 4
    Last Post: February 9th, 2012, 01:39 PM
  4. Language translation
    By archanaanbu in forum Member Introductions
    Replies: 1
    Last Post: February 9th, 2011, 07:01 AM

Tags for this Thread