r/javahelp • • Nov 04 '15

Ticket price help

I'm stuck on how to write a simple code for setting ticket prices ...I have an adult ticket which is double that of a child ticket.

Just want to know how I go about writing it.

Thanks

1 Upvotes

3 comments sorted by

7

u/king_of_the_universe Nov 04 '15
final int childTicketPriceInCents = 500;
final int adultTicketPriceInCents = 2 * childTicketPriceInCents;

I assume this is not helpful. If so, mind that you didn't quite give much information.

In case you're looking for how to write a console application where the user has to enter this: What have you tried? (We're not here to do your homework.)

5

u/Rascal_Two Intermediate Brewer Nov 04 '15

Going to need some more information/context. What do you want to do with these tickets? Do you want to make a program to keep track of tickets sold?

1

u/[deleted] Nov 05 '15

I'd say, just create a variable for the child ticket price, and another for adult ticket price. set the child price to x amount(whatever you want), and adult to 2x... I'm supposing thats not all you want, could you elaborate?