Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Design Suggestions?

33 views
Skip to first unread message

Henry

unread,
May 2, 2013, 5:56:00 PM5/2/13
to
I need someone to brainstorm with me about a very small project.

I'm trying to build a small private application (or applet) to simulate
a draw with a small number of tickets. It's for a club to which I belong.

Currently, we do the draw with real paper tickets, purchased from an
office supply place. Anyone who wants to purchase tickets indicates how
many they want and paper tickets, each containing two copies of a 6
digit unique number are torn in half so that each half has the unique
number intact. The buyer gets half of the ticket and the other half is
tossed into a hat or suitable container. Tickets sell for $0.25 each or
5 for a dollar. No one has ever bought more than 10 tickets for a given
draw. After everyone who wants one has their tickets, a neutral party
draws a winning ticket; the winner gets half of the cash raised by the
draw (rounded up to the nearest quarter if necessary) and one book or
DVD from a pile of books and DVDs donated by various members. After the
winner has claimed his/her prize, a second draw is made and the second
place winner gets first choice of the remaining books and movies but no
cash. Drawing continues with each subsequent winner getting first choice
of whatever books and films remain until all books and films are
exhausted. The club keeps the remaining half of the money raised by the
ticket sales. Tickets are discarded after the draw.

I want to write a Java application or applet that duplicates what
happens in our existing draw. I'm intrigued by Java FX and am tempted to
write the program that way to learn more about FX but I'm more familiar
with Swing and would be willing to go that way.

I've installed NetBeans 7.3 and Scenebuilder but as I look through
Scenebuilder, I don't see anything that looks like Card Layout. You see,
I'm picturing this like one of the Windows wizards where each stage is a
separate page of a CardLayout and you can go back and forth between
different stages. For example, the first "page" is ticket sales and for
each buyer, you put his/her name in a text box (or combo box) and use a
Spinner to set the number of tickets purchased. Then you calculate the
cost of those tickets and display it beside the number of tickets. Then
you collect that money from the buyer. When you have collected all the
money for all the tickets sold, you have finished Page 1 of the draw. At
that point, you click a Next button and go to Page 2.

Page 2 displays the ticket buyer names in a table or list. Beside each
buyer name is the unique numbers of the ticket that person has
purchased, e.g. 100001, 100002, 100003 or just 100006. (Ticket numbers
are given out sequentially, just as tickets appear sequentially numbered
in the paper roll of tickets.) At this point, a late arrival might want
to still buy tickets or an existing buyer may want to buy additional
tickets so it should be possible to go back to Page 1 and sell more
tickets, which will necessitate increasing the ticket count for an
existing buyer or adding a new buyer to the list. When that is done, you
go back to Page 2. The bottom of Page 2 needs a button that initiates
the actual selection of the winning tickets.

The winning ticket numbers should be listed in order (with buyer name)
on the third page. The person operating the program should be able to
scroll up and down if necessary and simply reads the list of winners
from top to bottom, stopping after reading each one to allow that person
to collect his prize before moving on. All the details of that draw -
who bought tickets, how many they bought, what ticket numbers were
issued, and which tickets won - should be written to a file so that it
can be easily viewed again at some point in case anyone wants to
challenge the fairness (or the randomness of the random number generator).

At least that's the way I'm thinking of doing this. Unfortunately, I
don't see how I can do that in JavaFX since I don't see any equivalent
to CardLayout there. But perhaps there is a better way to design this.
That's why I'm asking here.

Does anyone have any thoughts on the best way to design this?

Knute Johnson

unread,
May 2, 2013, 9:18:45 PM5/2/13
to
I don't think you need card layout. I see it more as a single frame
with a button to add more tickets, a list of all the ticket holders
names, with a name for each ticket they bought, and a button to produce
a random index to select a winner. You could have another button to
remove someone for a refund. Menu items for reports and clearing out
the database.

knute...

Roedy Green

unread,
May 29, 2013, 3:27:06 AM5/29/13
to
On Thu, 02 May 2013 17:56:00 -0400, Henry <He...@example.com> wrote,
quoted or indirectly quoted someone who said :

>Does anyone have any thoughts on the best way to design this?

The only tricky part of this is the randomising to simulate the draw.

see http://mindprod.com/jgloss/randomnumbers.html

Because you are collecting money, it would be very embarrassing if you
lost your records of who bought what because of a crash. This implies
you should store your information in a database, one with crash
protection. I suggest Postgre.

see http://mindprod.com/jgloss/sql.html
http://mindprod.com/jgloss/postgresql.html

If this is just a single-user desktop app, it will be a lot simpler
and secure than if you make it a multi-user or web app.

Performance is not a concern. The total amount of data is trivial.
--
Roedy Green Canadian Mind Products http://mindprod.com
Technological possibilities are irresistible to man.
If man can go to the moon, he will.
If he can control the climate, he will.
~ John von Neumann (born: 1903-12-28 died: 1957-02-08 at age: 53)

Lew

unread,
May 30, 2013, 3:55:02 PM5/30/13
to
Roedy Green wrote:
> Because you are collecting money, it would be very embarrassing if you
> lost your records of who bought what because of a crash. This implies
> you should store your information in a database, one with crash
> protection. I suggest Postgre.

The database system's name is not "Postgre". It's either "Postgres" or "PostgreSQL".
http://wiki.postgresql.org/wiki/ProjectName

See also:

http://www.postgresql.org/about/history/
"PostgreSQL, originally called Postgres, ...
"With the start of its new life in the open source world, with many new features and enhancements,
the database system took its current name: PostgreSQL. ("Postgres" is still used as an
easy-to-pronounce nick-name.)"

http://en.wikipedia.org/wiki/PostgreSQL
"PostgreSQL, often simply Postgres, ..."

http://www.postgresql.org/docs/9.0/static/history.html
"Many people continue to refer to PostgreSQL as "Postgres" (now rarely in all capital letters)
because of tradition or because it is easier to pronounce. This usage is widely accepted as a
nickname or alias."
From that MindProd site:
"It is also known as Postgres, but never Postgre."

--
Lew

Roedy Green

unread,
May 31, 2013, 12:36:02 PM5/31/13
to
On Thu, 30 May 2013 12:55:02 -0700 (PDT), Lew <lewb...@gmail.com>
wrote, quoted or indirectly quoted someone who said :

>From that MindProd site:
>"It is also known as Postgres, but never Postgre."

You corrected me before. It is was easier to update the HTML than my
neurons.
--
Roedy Green Canadian Mind Products http://mindprod.com
Getting information off the Internet is
like taking a drink from a fire hydrant.
~ Mitch Kapor 1950-11-01

Lew

unread,
Jun 2, 2013, 3:56:31 PM6/2/13
to
Roedy Green wrote:
>Lew wrote, quoted or indirectly quoted someone who said :
>> From that MindProd site:
>> "It is also known as Postgres, but never Postgre."
>
> You corrected me before. It is was easier to update the HTML than my
> neurons.

My concern is to promulgate correct information to those who read this thread.

We don't want to lead any newbies astray, now do we?

--
Lew
0 new messages