Jump to content




Recent Status Updates

View All Updates

Binpress - Cut your development time and costs in half
Photo
- - - - -

Java Poll


  • Please log in to reply
5 replies to this topic

#1 JavaBeginner

JavaBeginner

    CC Lurker

  • Just Joined
  • Pip
  • 2 posts

Posted 12 April 2012 - 09:29 AM

Hi, I work at a radio station and recently I want to develop a easier way our viewers get in touch with us. One of the most popular features of a local radio station is the use of indicative opinion polls to reflect their listener’s opinions on current news items and events. The polls ask a question and then four responses. The listener selects the answer which they most favour. We use the polls and results in phone-in programmes to generate interest in certain programmes.

So anyways here's my problem; I want to create a basic poll.

For example -

Question - Which country out of the four would you want to go on holiday too?

Responses USA, Thailand, Greece, Italy

So basically what I'm trying to implement is when the program starts it will display an initial menu screen with the following set of options:
1. Display the current score for each possible response.
2. Vote
3. Quit the program.
Display an error message if an invalid response is entered.
If the user selects option two, the program will display the question and the four possible responses. The user will then enter a response and the response will be recorded in the program. Again display an error message if the response is invalid.
The thing I'm trying to do is create one class with the following data:
 Survey question
 Four possible responses
 The current score for each response
It should contain the following methods:
 A setter and getter for the survey question
 Setters and getters for each of the responses
 addVotes, which will add one to the score for the specified response.

It's been years since I've last done java and I really need some help, if anyone can point in the right way with the coding that would be great.

I am using Jedit for the coding.
  • 0

#2 gregwarner

gregwarner

    Obi Wan of Programming

  • Expert Member
  • PipPipPipPipPipPipPip
  • 1,574 posts
  • Location:Arkansas
  • Programming Language:C, Java, C++, C#, PHP, Transact-SQL

Posted 12 April 2012 - 10:47 AM

Firstly, I would recommend using a better IDE to do your coding instead of JEdit. Netbeans and Eclipse are the two most popular ones, and are very good.

Secondly, and this isn't really related to programming but rather to data collection, but have you considered not revealing the current poll statistics until after the user has made their choice? The reason is because seeing the current poll statistics before a choice is made may influence the user's decision making, whereas polls are intended to get the user's unbiased response. This is typically how online polls are conducted. (The results aren't shown until after a selection is made.)

Lastly, what do you have so far? There are many different ways to approach this, some good, some not so good. We would have to see your progress so far in order to give helpful advice.

Even more lastly, this probably would get more responses if it were posted in the Java help forum.
  • 0

ti-99-sig.png
Hofstadter's Law: It always takes longer than you expect, even when you take into account Hofstadter's Law.
– Douglas Hofstadter, Gödel, Escher, Bach: An Eternal Golden Braid


#3 JavaBeginner

JavaBeginner

    CC Lurker

  • Just Joined
  • Pip
  • 2 posts

Posted 12 April 2012 - 12:01 PM

At the moment I actually don't have much considering everything I tried so far hasn't quite came out like how I had hoped hence me coming on here and asking for help.

I can do basic coding but I'm totally lost on this occasion; and yes I understand your view on seeing the statistics after the user has voted but I want to keep it basic it for now.

I'll post this on the Java help forum too I guess.
  • 0

#4 gregwarner

gregwarner

    Obi Wan of Programming

  • Expert Member
  • PipPipPipPipPipPipPip
  • 1,574 posts
  • Location:Arkansas
  • Programming Language:C, Java, C++, C#, PHP, Transact-SQL

Posted 12 April 2012 - 12:49 PM

No need to cross post. A moderator will probably move it eventually.

Aside from programming, what sort of planning steps have you taken so far? A project like this should begin with the conceptual planning before you ever get to coding.

These are the types of questions you need to answer before you can know how to move ahead: How do you plan on delivering this software? (Applet in browser? Downloadable program? Mobile app?) Will it have a GUI? What will the GUI look like? (Draw it out.) What will you use for your data-storage backend? (Database? flat files?) How will you host the backend? (Your own server vs. Hosted services such as JSP/Tomcat/Glassfish)

Once you have your design nailed down, we can begin to talk about how to code it.
  • 0

ti-99-sig.png
Hofstadter's Law: It always takes longer than you expect, even when you take into account Hofstadter's Law.
– Douglas Hofstadter, Gödel, Escher, Bach: An Eternal Golden Braid


#5 WingedPanther

WingedPanther

    A spammer's worst nightmare

  • Moderator
  • 16,924 posts
  • Location:Upstate, South Carolina
  • Programming Language:C, C++, PL/SQL, Delphi/Object Pascal, Pascal, Transact-SQL, Others
  • Learning:Java, C#, PHP, JavaScript, Lisp, Fortran, Haskell, Others

Posted 12 April 2012 - 01:11 PM

Firstly, I would recommend using a better IDE to do your coding instead of JEdit. Netbeans and Eclipse are the two most popular ones, and are very good.


Just a note: jEdit has some very powerful features (I use it regularly for it's RegEx support). If you're doing GUI development, however, it's probably not your best choice.
  • 0
Programming is a branch of mathematics.
My CodeCall Blog | My Personal Blog

#6 Norm

Norm

    CC Addict

  • Senior Member
  • PipPipPipPipPip
  • 396 posts
  • Location:Eastern Florida
  • Programming Language:Java, C++, Assembly

Posted 12 April 2012 - 01:41 PM

Also posted at http://www.javaprogr...lease-help.html
  • 0




Powered by binpress