• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Paul Clapham
  • Jeanne Boyarsky
  • Junilu Lacar
  • Henry Wong
  • Ron McLeod
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Frits Walraven
  • Tim Holloway
  • Carey Brown
  • Piet Souris
  • salvin francis
  • fred rosenberger

Amusement park ticketing system for java

Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Been studying Java for a few weeks now and I still can't get to thinking like a programmer. I need to create an application where the user chooses between a daily unlimited rides ticket and a daily single rides ticket. Based on a user’s selection he/she is further given the choice of the various sub-categories within the chosen category. The user then enters the ticket quantities for the chosen sub-category. This process of choosing between the two main categories of unlimited and single rides tickets, and entering the number of tickets for the chosen sub-category needs to continue till the user elects to exit the program. For each iteration, a sub-total of the amount payable is displayed. Once the user exits the program, the user should be displayed with the total amount payable for all the tickets.

I'm thinking I may need to create a method that computes the price of the specific ticket purchased, but how do I give the user the option to continue or exit the program whilst showing the subtotal all the time. Also, what would be the best way to deal with the tickets and prices of each ticket? I was hoping there is a way to associate the price with ticket in a variable or something. And lastly, can someone give me an idea on how to apply the discounts for bulk purchases? I apologise in advance if I am asking a lot, you do not have to give me code, just point me in the right direction. Thanks
Saloon Keeper
Posts: 7175
Eclipse IDE Firefox Browser MySQL Database VI Editor Java Windows
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A good way to begin object oriented design is to look for nouns and verbs in your requirements. Nouns tend to be implemented as classes (e.g. Ticket). Verbs tend to be methods (e.g. calculatePrice()).

Look for is-a relationships which are often a hint towards inheritance (your case may not have this situation). Look for has-a relationships which would be aggregation (i.e. member variables or "fields").
Posts: 69411
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
. . .  and welcome to the Ranch
WARNING! Do not activate jet boots indoors or you will see a tiny ad:
Devious Experiments for a Truly Passive Greenhouse!
    Bookmark Topic Watch Topic
  • New Topic