Results 1 to 16 of 16
  1. #1
    Aash96 is offline Member
    Join Date
    Dec 2012
    Posts
    26
    Rep Power
    0

    Default Any ideas/thoughts on making a voting program using the Netbeans IDE 6.0

    We expected to write a program that could be used to manage the one of these:

    An election process
    A competition to identify a winner

    Well basically, i think, we have to determine the highest number of votes and return its string value hence identifying a winner
    Now we have to create tables in MS Access(2010) and i was wondering what kind of information can i add here(besides the name of contestants etc.)

    Examples are: Idols, Miss High School, Funniest Video, Local government elections

    Now can you briefly explain how do i go around doing this project(Must we have a number of votes column in access? and interpret the winner through that?)

    Thanks for answering these questions, Help much needed. Grade 12 Information Technology Student(A candidate)

  2. #2
    DarrylBurke's Avatar
    DarrylBurke is offline Member
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,188
    Rep Power
    19

    Default Re: Any ideas/thoughts on making a voting program using the Netbeans IDE 6.0

    Quote Originally Posted by Aash96 View Post
    We expected to write a program that could be used to manage the one of these:

    An election process
    A competition to identify a winner

    Well basically, i think, we have to determine the highest number of votes and return its string value hence identifying a winner
    Now we have to create tables in MS Access(2010) and i was wondering what kind of information can i add here(besides the name of contestants etc.)

    Examples are: Idols, Miss High School, Funniest Video, Local government elections

    Now can you briefly explain how do i go around doing this project(Must we have a number of votes column in access? and interpret the winner through that?)

    Thanks for answering these questions, Help much needed. Grade 12 Information Technology Student(A candidate)
    Where does Java come into this?

    db
    If you're forever cleaning cobwebs, it's time to get rid of the spiders.

  3. #3
    DarrylBurke's Avatar
    DarrylBurke is offline Member
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,188
    Rep Power
    19

    Default Re: Any ideas/thoughts on making a voting program using the Netbeans IDE 6.0

    Also please go through the Forum Rules, particularly the second paragraph.

    The other thread you started with the identically same post has been removed.

    db
    If you're forever cleaning cobwebs, it's time to get rid of the spiders.

  4. #4
    Aash96 is offline Member
    Join Date
    Dec 2012
    Posts
    26
    Rep Power
    0

    Default Re: Any ideas/thoughts on making a voting program using the Netbeans IDE 6.0

    Okay, the language we using JAVA and we have to create GUI Program that achieves this goal. Wow, i did not see that, utterly sorry for that.

  5. #5
    Tolls is online now Moderator
    Join Date
    Apr 2009
    Posts
    11,800
    Rep Power
    19

    Default Re: Any ideas/thoughts on making a voting program using the Netbeans IDE 6.0

    I can only think that they want you to store the results in the database.
    I'd ask, frankly, just to be sure.

    Consider this a lesson in requirements gathering or something.
    Please do not ask for code as refusal often offends.

    ** This space for rent **

  6. #6
    Aash96 is offline Member
    Join Date
    Dec 2012
    Posts
    26
    Rep Power
    0

    Default Re: Any ideas/thoughts on making a voting program using the Netbeans IDE 6.0

    No Tolls, you see our last project was a transporting company which we had store information(departure, Destination etc.) in a database and write a GUI Program which accomplishes this task, and next year's project is a program that manages to find a winner or select a group of representatives.

  7. #7
    Tolls is online now Moderator
    Join Date
    Apr 2009
    Posts
    11,800
    Rep Power
    19

    Default Re: Any ideas/thoughts on making a voting program using the Netbeans IDE 6.0

    It's an election, though.
    I can't see what else you'd put in the db apart from a single Canididate table with Name and Votes.
    I mean you can pad the table out with other details I suppose.
    You could log individual votes maybe, but that all comes down to what the requirements are.
    And a two line requirement doc isn't exactly detailed.

    The single table would fulfill it and, when the voting is done, you could simply "SELECT name FROM candidates ORDER BY votes DESC".
    First candidate is the winner.
    Please do not ask for code as refusal often offends.

    ** This space for rent **

  8. #8
    DarrylBurke's Avatar
    DarrylBurke is offline Member
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,188
    Rep Power
    19

    Default Re: Any ideas/thoughts on making a voting program using the Netbeans IDE 6.0

    Quote Originally Posted by Tolls View Post
    when the voting is done, you could simply "SELECT name FROM candidates ORDER BY votes DESC".
    First candidate is the winner.
    Java Code:
    SELECT TOP 1 name FROM candidates ORDER BY votes DESC
    If you're forever cleaning cobwebs, it's time to get rid of the spiders.

  9. #9
    Aash96 is offline Member
    Join Date
    Dec 2012
    Posts
    26
    Rep Power
    0

    Default Re: Any ideas/thoughts on making a voting program using the Netbeans IDE 6.0

    Yes! I see where you are going with this. I could create another table which allows people to register and votes using the 'INSERT' function with a condition that they are over 18. But they also said, that we must provide relevant statistics. And they mean what??? I don't really know much about how am i going to expand this program besides from a login and registering screen.

  10. #10
    Tolls is online now Moderator
    Join Date
    Apr 2009
    Posts
    11,800
    Rep Power
    19

    Default Re: Any ideas/thoughts on making a voting program using the Netbeans IDE 6.0

    Quote Originally Posted by DarrylBurke View Post
    Java Code:
    SELECT TOP 1 name FROM candidates ORDER BY votes DESC
    Is there a swear filter on this forum?
    :)
    Please do not ask for code as refusal often offends.

    ** This space for rent **

  11. #11
    Aash96 is offline Member
    Join Date
    Dec 2012
    Posts
    26
    Rep Power
    0

    Default Re: Any ideas/thoughts on making a voting program using the Netbeans IDE 6.0

    After the numbers are sorted in descending order, how should i extract the 1st number from the sorted numbers????? Note these are from the table
    Last edited by Aash96; 12-13-2012 at 06:21 PM.

  12. #12
    Tolls is online now Moderator
    Join Date
    Apr 2009
    Posts
    11,800
    Rep Power
    19

    Default Re: Any ideas/thoughts on making a voting program using the Netbeans IDE 6.0

    Since this is a Java forum I would assume JDBC?
    Please do not ask for code as refusal often offends.

    ** This space for rent **

  13. #13
    Aash96 is offline Member
    Join Date
    Dec 2012
    Posts
    26
    Rep Power
    0

    Default Re: Any ideas/thoughts on making a voting program using the Netbeans IDE 6.0

    No i am not loading any drivers, i found this to be much easier as i can run many projects at the same time that needs a connection without loading drivers. You said i can sort the number of votes in descending order, can i also use SELECT(MAX)? and i don't want the highest number only, i need the highest number corresponding with its string value eg. A name of a person. Any ideas???

  14. #14
    Aash96 is offline Member
    Join Date
    Dec 2012
    Posts
    26
    Rep Power
    0

    Default Re: Any ideas/thoughts on making a voting program using the Netbeans IDE 6.0

    My Connection Class(Much easier): I just place the database in my Netbeans Project folder and it automatically connects 110%

    import java.sql.*;
    import java.io.*;
    import javax.swing.JOptionPane;

    public class dbclass {

    Connection conn;
    ResultSet queryTbl;


    public dbclass()
    {

    try
    {
    Class.forName ("sun.jdbc.odbc.JdbcOdbcDriver");
    //JOptionPane.showMessageDialog(null, "Driver successfully loaded","Connection", JOptionPane.INFORMATION_MESSAGE);

    }
    catch (ClassNotFoundException c)
    {
    JOptionPane.showMessageDialog(null, "Unable to load database driver","Connection", JOptionPane.ERROR_MESSAGE);

    }


    //connect to the database
    try
    {

    String filename = "testDB.mdb";
    String database = "jdbc:odbc:Driver={Microsoft Access Driver (*.mdb)};DBQ=";
    database += filename.trim () + ";DriverID=22;READONLY=false}";
    conn = DriverManager.getConnection (database, "", "");

    //JOptionPane.showMessageDialog(null,"Connection to database successfully established","Connection", JOptionPane.INFORMATION_MESSAGE);


    }
    catch (Exception e)
    {
    String err = "Unable to connect to the database" + " " + e;
    JOptionPane.showMessageDialog(null,err,"Connection ", JOptionPane.ERROR_MESSAGE);
    }
    } //end connection

    public void updateTbl ( String sqlStmt ) throws SQLException
    {
    Statement stmt = conn.createStatement();
    stmt.executeUpdate(sqlStmt);
    stmt.close();
    }//updateTbl

    ResultSet queryTbl ( String sqlStmt ) throws SQLException
    {
    Statement stmt = conn.createStatement();
    ResultSet rs = stmt.executeQuery(sqlStmt);
    return rs;
    }//queryTbl

    public String quote( String S )
    {
    return "'"+S+"'";
    }


    }

  15. #15
    Tolls is online now Moderator
    Join Date
    Apr 2009
    Posts
    11,800
    Rep Power
    19

    Default Re: Any ideas/thoughts on making a voting program using the Netbeans IDE 6.0

    Please wrap your code in [code] tags [/code] otherwise it loses all formatting and is hard to read.
    SELECT MAX will just give you the maximum value of votes, not including the name (unless you make it more complex).
    Darryl's query will give you the top result, supplying the name. If you want the votes as well then simply add in that column to the statement.

    And I didn't understand about "not loading drivers". You cannot connect to a database without loading a driver of some sort.
    Please do not ask for code as refusal often offends.

    ** This space for rent **

  16. #16
    Aash96 is offline Member
    Join Date
    Dec 2012
    Posts
    26
    Rep Power
    0

    Default Re: Any ideas/thoughts on making a voting program using the Netbeans IDE 6.0

    Yes, well actually i am not configuring control panel to connect to my database, no that code is not important, was just showing the connection class i used. Thanks.

Similar Threads

  1. Suggestions? Ideas? Thoughts?
    By n00624657 in forum Eclipse
    Replies: 1
    Last Post: 10-12-2011, 09:35 AM
  2. Java Program Ideas!
    By Alerhau in forum New To Java
    Replies: 10
    Last Post: 06-20-2011, 09:58 AM
  3. School project: network program via java any ideas?
    By Sernomicus in forum New To Java
    Replies: 2
    Last Post: 12-07-2009, 03:46 PM
  4. Any ideas on Program for begginer?
    By SwEeTAcTioN in forum New To Java
    Replies: 5
    Last Post: 11-02-2009, 01:45 AM
  5. Any ideas to create a filter program?
    By paulachrist in forum New To Java
    Replies: 4
    Last Post: 07-11-2008, 03:53 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •