Go Back   TechArena Community > Software > Software Development
Become a Member!
Forgot your username/password?
Tags Active Topics RSS Search Mark Forums Read

Reply
 
Thread Tools Search this Thread
  #1  
Old 23-11-2009
Member
 
Join Date: Aug 2009
Posts: 56
Creating object and server prices in JAVA

I want to create a class type (Price) with three attributes (departure, arrival, price) to model a ticket booth. I must also create a Server class that stores data such as prizes (with the aid of an array of type money). The user must enter the On arrival and departure and the class ticket booth must fetch prices in the table priceof the Server class. Can anyone help me how to create such kind of class?
Reply With Quote
  #2  
Old 23-11-2009
Member
 
Join Date: May 2008
Posts: 2,383
Re: Creating object and server prices in JAVA

Rather than ultra-simple, I suggest you just use a Map to store with prices as the key string concatenation "start" and "arrival". Or, as a map with key "start" as a value and a second map with key as "arrival" as a value and price.
__________________
The FIFA Manager 2009 PC Game
Reply With Quote
  #3  
Old 23-11-2009
Member
 
Join Date: Feb 2008
Posts: 1,848
Re: Creating object and server prices in JAVA

The map does not have multiple identical keys, therefore the validity of your solution depends on what he wants to save it. Also the 1st solution makes it difficult to search.

A solution that works on at once, but not necessarily optimized to be stupid in a list all your items and price go in ensuring that the criteria are.
Reply With Quote
  #4  
Old 23-11-2009
Member
 
Join Date: May 2008
Posts: 2,383
Re: Creating object and server prices in JAVA

I thought a key style string concatenation departure and arrival.

Examples of keys:

"Paris-Rouen"
"Lille-Calais"

And as a value priced digital form.
__________________
The FIFA Manager 2009 PC Game
Reply With Quote
  #5  
Old 23-11-2009
Member
 
Join Date: Aug 2009
Posts: 56
Re: Creating object and server prices in JAVA

Thank you for your explanations, what I want is basic, I will explain:
I want to create an object type Price

public class Price {
String departure;
String arrival;
double price;
}

the class server and create an array of type Price
Price [] tablePrice;
but after I blocked I can not see how the rest.

I must also create another class of Tickets that must be called to the class server.
Reply With Quote
  #6  
Old 24-11-2009
Member
 
Join Date: Feb 2009
Posts: 96
Re: Creating object and server prices in JAVA

your question isn't so easy to understand....

basically if I understand it correctly you need 2 classes

class 1 is an object class
class 2 is your main class

class 1 contains data for the object such as arrival, departure, and monies involved

class 2 uses said information to retrieve the data from the created object

now with that said making an object with a departure and arrival times along with prices makes no sense to me -- seems like you should be placing cities in the arrival/departure area
anyways you'll need to create a loop to check to see if the price matches what you have -- and in order to do this your loop needs to be set up something like

for(int i = 3; i<something.length; i++)
method here
Reply With Quote
Reply

  TechArena Community > Software > Software Development
Tags: , ,



Thread Tools Search this Thread
Search this Thread:

Advanced Search


Similar Threads for: "Creating object and server prices in JAVA"
Thread Thread Starter Forum Replies Last Post
Getting HP AIO Device object server register class object failed message on my system Donoho Hardware Peripherals 6 06-06-2011 01:34 AM
How big is an Object in Java? Why Java neglects sizeof? KALINDA Software Development 4 10-11-2009 03:19 AM
Creating a Vector Object in Java Coldman Software Development 4 04-03-2009 02:45 PM
Object test = new Object() <-- Java, best way in C++ ADISH Software Development 3 25-10-2008 02:32 PM


All times are GMT +5.5. The time now is 06:58 AM.