I am programming a little java application but since my java skills are only 2 or 3 month old I am faced with some technical difficulties.
My problem is the following : A customer call a hotel and wants to rent a room. The employee (using the application) takes note of the customer name, phone and the dates where he will arrive and leave (that part is done). When the customer arrive to my hotel, the employee finds the reservation using the customer confirmation number. He now has an interface where he see's the available room for the selected class (economy, first class, etc.).
I want my employee to select X ammount of room, where X is the room ordered by the customer. I am using a JList to show the rooms number. The problem is I can only set the selection mode to a single or multiple lines :
myList.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
myList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
I read all the javadoc and tried to find an existing method to set a limit to the MULTIPLE_INTERVAL_SELECTION, but in vain.
Any suggestion?
PS. My english is not the best. I'm trying to make this as clear as possible.
Related
I'm making a java web application for my golf society.
So far I've made all the user accounts and roles. I've made an events table in my database where a new event can be created. So far the event contains, id, name, course, date, cost and winner. Winner is null until the event has finished when a winner is entered.
I'm wanting to move on now and allow members to enter an event via the app and then a list of current entrants will be shown for each event. But I am stuck on how to go about this. I've thought about having a column in the DB for entrants, which will hold an array of people who have entered, but cannot find how to do it this way.
I have searched online for days and found nothing that helps.
Secondly once this is complete, the members who have entered would input their score for the round and this would create a leaderboard for each event.
I know this is possible as I use an app via my club which does the exact same thing, but I have spent days searching the internet but have come to a dead end.
I am working on an app right now where a person will be able to add different people to a list and then reuse those people. After they select a person, they can move on to a screen where you check a bunch of boxes such as "carrot" or "potato". Each person that is added needs to have a unique "carrot" or "potato" int so it can be used later to count up all the amount of times that carrot or potato has been checked off.
How do I go about doing the int creating whenever a new person is added? I know what to do from there but I honestly have no idea what to do about this.
So if I have a person created named "nick" I can create an int called "carrotnick". I need that id to be displayed later on without me knowing that there is a nick on the end, only the carrot part. So it can't be completely random. Still needs to be displayed later on somehow.
Use sqlite and a table with auto incremental field so for each person which be added to table there is a unique id so you can either get ids after app restarted
I am using parse.com cloud storage, to implement level sharing/downloading and rating for built in level editor for my game, so players are allowed to built and test their own created levels, latter on they can share it with different players, that`s how I upload it to the parse.com cloud storage:
ParseObject testObject = new ParseObject("Levels");
testObject.put("file", new ParseFile(name + ".lvl", levelString.getBytes()));
testObject.put("author", authorName);
testObject.put("email", authorEmail);
testObject.saveInBackground();
It works fine, but I wanted to let players also rate downloaded levels (lets say 1-5 stars) it could be simple, by creating new two fields called rating and ratings count, so every time someone will vote, I would add it to ratings count and would ++ ratings count.
Problem is, how to prevent player from rating particular level multiple times? Thanks.
I have thought about this for a project of mine. In the end you will need two data points.
You need to track the counts per rank on the object (Level in your case)
You need to track UserLevelRating, at minimum a reference to the user, reference to the target (Level), and the rating given (if you will let people change ratings)
Depending on how you want to implement it, to prevent rating something twice, or to allow people to change the rating they have given something, you would do a query for the current user and the Level. If a record is returned they have already voted, so prevent them from voting again.
You could add some cloud code using before-safe or after-save logic to handle other things, such as changing the vote and updating the counts on the target (Level).
Here's a sample of the logic I would use for a simple single vote system without changing votes:
Test for existence of UserLevelRating record, if it exists prevent voting
Saving vote, include User=current user, Level=selected level, Rating=stars given
Cloud code, in after-save of UserLevelRating, looks at Level property, loads the level, calls increment on the property for the rating (e.g. if Rating=3, increment("Stars3") would be called)
Anytime you load a Level object you would have counts for each rating, and could produce the average.
I've a sports application where the captain can register his team for a tournament. There can be multiple tournaments in an year and each tournament requires registration. Now, I want to support the below in registration process
If a Player has already participated in the previous tournament then the app need to reuse the existing details rather forcing the registration.
Need to make sure that a Player is not playing for two teams.
I am wondering how can we best implement the name match feature. It it makes any difference, most of the names are from Indian origin.
I am using Neo4j as the data store.
You use db4o and use unickey feature for field name in player class.
Tornament class have a (Set) field with players name (and at least a reference indexed name, date name may also be indexed).
Then with two fields : the last tournament and the registration for the next one you have for one player only one tournament.
Using SODA query you can select player with last referenced tournament, and register the others
I'm currently ddeveloping a hospital managment system.
My application will have multi cashiers at the hospital who working 24/7, they collecting money from the patients & issuing a receipt voucher or returning money back to patient in case of refunding.
currently i'm storing the employee user account no for each transaction, at the end of the day the employee print a list of the transaction that he made with total of money he have to send to the accountant department.
but i need some one to tell me what is the polices needed to prevent any msitake with total amount that employee have in his/her cash box.
Do i need to prevent others from deleting or revesing the record even the head of the accounting department?
I thing i need something as bank tellers, but i can't find something to help me or explain to me what exactly i need to put in my polices for this part.
I'm using: Java as GUI & programming language, MySQL (Percona) as my database, Crystal Reports As my reporting & Printing solution.
I think you need to think about this a bit more atomically. Rather than there being transactions which can be edited or removed, just have actions which occur.
So sure have your people run a transaction in, and if someone wants to edit that transaction let them but do it as changeset, a bit like how version control systems work. So you still retain the information on the original transaction but then have the change that should be applied to that transaction.
If you have some base Id for the transaction/action and then each change set points to that then at least you can tie all changes together by date order and then run them to work out the total, which you can easily cache for performance purposes later on.
Whenever money is involved its VERY risky to allow editing or removal of data, which is why most places tend to retain all information and just either archive it as out of date and put a more up to date record in its place, or have some data trail of the original record and what has changed on it.
Ultimately it all comes down to tracability...