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

Thread: Final Project - Trivia Game

  1. #1
    Junior Member
    Join Date
    May 2011
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Final Project - Trivia Game

    I'm currently in a pre-ap java programming exposure class. For our final project, we must make some sort of working program like a video game of sorts. It can't be a simple slide show type game. The problem is, ladies and gentlemen witnessing my plea, that the "pre-ap" factor of this class has caused me problems. I don't have trouble maintaining a good grade in the class. But it's to the point that these last few months have been us being rushed through chapter questions to the point where you have to use control-F to find answers to get done in time opposed to actually reading the material and learning. Which leads me to believe I'm in need of lots of grace.

    The program itself, what I thought would be simplest, is to make a trivia game with four categories, each of the categories having 1-2 questions. I also wanted to include the 'back' and 'next' buttons. This is as far as I've gotten as to ideas. The true problem is actually coding it. In all honesty, I understand simple concepts, but the entire class we've never had to start from scratch, and all the coding for more complicated parts of the program was already given to us, so when it comes to what to actually write from scratch, I've got nothing.

    Be aware that if you post on this offering help, I will be asking several questions and you may be here awhile. Thanks!


  2. #2
    Crazy Cat Lady KevinWorkman's Avatar
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    5,357
    My Mood
    Hungover
    Thanks
    144
    Thanked 626 Times in 537 Posts

    Default Re: Final Project - Trivia Game

    First off- break your problem down into much smaller steps. Break those small steps up into even smaller steps. Keep them separated until you have them working perfectly, then worry about combining them.

    Write out what you want to happen, as specifically as possible. Pretend you have a really dumb friend, and write directions for him to follow.

    Concentrate on the simplest thing you know you have to do, and go from there. When you get stuck, break the problem down into an SSCCE and ask a specific question, and we can help you from there.

    This might sound like more work, but I promise, it will save you a ton of headaches along the way.
    Useful links: How to Ask Questions the Smart Way | Use Code Tags | Java Tutorials
    Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!

  3. #3
    Junior Member
    Join Date
    May 2011
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: Final Project - Trivia Game

    We've started and made progress. Not near as bad as I thought it would be. We went with the idea of having a program that displayed all the 50 states with their own individual button, and when you clicked on the button, it took you to a slide of that state's bird and gave information on it. Rather simple, but what I'm wondering is: Do I have to make a method for each individual state? Because each state is going to have to have their own individual slide for when you click on their button. Also, we're intending to add a 'back' button. I know to use an if statement for whenever they click in a certain area to perform a certain task. But I don't know how to get the back button to redirect them to the original slide at the beginning.(Which is the one with all 50 states' buttons on them.)

  4. #4
    Junior Member
    Join Date
    May 2011
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: Final Project - Trivia Game

    Another thing I just realized that I didn't mention was that we also intend on adding the 'next' button. The same thing I'm confused about the 'back' button with applies here. I know how to use the if statement for when the user is clicking in a certain area, but I don't know exactly what to tell it to do. I'm going to have to tell it to go to the next slide.(because we have 25 states on the first slide, 25 on the next) But I don't know the coding to do so.

  5. #5
    Forum old-timer
    Join Date
    Nov 2008
    Location
    Faversham, Kent, UK
    Posts
    471
    My Mood
    Mellow
    Thanks
    4
    Thanked 58 Times in 54 Posts

    Default Re: Final Project - Trivia Game

    This kind of thing is usually done with a combo box - a dropdown list of items (e.g. names of states) from which you can select an item. Use an array of buttons if that's what you really want, but it sounds a bit clunky to me... When an item is selected, its name or index number is used to select the image to be displayed. To do this selection, you could use a method that takes the name of the state and reads an image file with that name from an image folder on the disk. Alternatively, you might have read all the images into your program at the start, so you might have a map that holds the images keyed by state name. You could then use the name to retrieve the image from the map.

    An important concept in coding is to avoid duplicating code. If you have to do the same operation with many different items of data, use the same code each time (e.g. a method, or a loop) and pass the data items to it (e.g. as method parameters).

  6. #6
    Forum old-timer
    Join Date
    Nov 2008
    Location
    Faversham, Kent, UK
    Posts
    471
    My Mood
    Mellow
    Thanks
    4
    Thanked 58 Times in 54 Posts

    Default Re: Final Project - Trivia Game

    You don't need an 'if' statement to tell if a button is clicked - you add an ActionListener to it and the actionPerformed method is automatically called. It's the same for a combo box selection.

    Follow the links for details.

    To move to the next or previous image, you will need to keep track of the index of the current image and increment or decrement that to find which image to retrieve.

Similar Threads

  1. Final year java project
    By aj4u in forum The Cafe
    Replies: 3
    Last Post: October 13th, 2011, 12:47 AM
  2. final project idea
    By zulqar in forum AWT / Java Swing
    Replies: 4
    Last Post: November 3rd, 2010, 07:28 AM
  3. final project idea
    By zulqar in forum Java Theory & Questions
    Replies: 1
    Last Post: November 1st, 2010, 12:02 PM
  4. need idea for final year project
    By asadkhan in forum Java Applets
    Replies: 0
    Last Post: August 22nd, 2010, 01:36 AM
  5. java Final Project Error
    By JavaStudent_09 in forum What's Wrong With My Code?
    Replies: 18
    Last Post: August 21st, 2010, 09:23 PM