Carey Brown wrote:I don't see anywhere where you are creating a new Purchase or a new Customer. Presumably you'd be keeping some sort of Collection of these.
Stephan van Hulst wrote:So, first read all customers and put them in a Map keyed by customer ID. Then read all purchases, but instead of storing a customer ID in your Purchase class, store an actual Customer, which you look up from your customer map.
There are three kinds of actuaries: those who can count, and those who can't.
Kristina Hawkins wrote:Purchase class has to have a long CustomerId.
Stephan van Hulst wrote:
Kristina Hawkins wrote:Purchase class has to have a long CustomerId.
Why?
Kristina Hawkins wrote:
Stephan van Hulst wrote:
Kristina Hawkins wrote:Purchase class has to have a long CustomerId.
Why?
that is what it says in the specs for the assignment
Paul Clapham wrote:
Kristina Hawkins wrote:
Stephan van Hulst wrote:
Kristina Hawkins wrote:Purchase class has to have a long CustomerId.
Why?
that is what it says in the specs for the assignment
Something which the assignment didn't mean to teach you: in real life too, you will sometimes be given specs which could easily be improved on.
Anyway, given this requirement you're going to need to build something which can be given a customer ID and return the matching Customer object.
There are three kinds of actuaries: those who can count, and those who can't.
Piet Souris wrote:Look at the Long class to see how to convert a String to a Long (or long), and likewise for other types.
There are three kinds of actuaries: those who can count, and those who can't.
Piet Souris wrote:Look at the way you create a Customer, then you know what conversions to make.
There are three kinds of actuaries: those who can count, and those who can't.
Piet Souris wrote:Well,
you're using the Builder pattern to create a new Customer. Every parameter for this building is already a String, except for cusomer_id. So, if you read in the values of the CSV file, you should only need to convert the customer_id into a long, and then you create a Customer via the Builder.
There are three kinds of actuaries: those who can count, and those who can't.