reset password
Author Message
darkserith
Posts: 45
Posted 08:24 Feb 12, 2016 |

HW3 says Zip Code searches should only support exact matches. 

Question 1)

In starbucks.csv, there are three starbucks location with the following zip codes:

Name              Zip

Starbucks1     97302

Starbucks2     97302

Starbucks3     97302-4682

Would a zip code search for "97302" yield Starbucks1, Starbucks2, AND Starbucks3?

Or no, the search would yield only Starbucks1 and Starbucks2 since the 4 digit extension to the zip code of Starbucks3 does not mean it should be thought of as the same (e.g. 97302-4682 != 97302).

And vice versa, would a search for 97302-4682 yield Starbucks1, Starbucks2, and Starbucks 3, or no, it should only yield Starbucks3, since 97302-4682 != 97302.

<! ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- !>

Question 2)

In starbucks.csv, some locations (COLUMN C or the third column) have the name value of "Vons" or "Wells Fargo" or "Carlsbad Company Stores". Are these actual StarBucks shop LOCATED INSIDE Vons or Wells Fargo? Or no, they are just values just to make us do more work (e.g. we have to say, name.contains("Starbucks") in order for a particular entry to be considered a starbucks location in the first place, and therefore would NOT show up in the search results table since the user is only interested in Starbucks shops and nothing else?

Or put it another way, is EVERY entry inside starbucks.csv a valid starbucks location. Most of the entrys in the third column are "Starbucks: Anaheim" or "Starbucks: Honolulu" but there are quite a few that are not.

<! ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- !>

 

Thanks.

Last edited by darkserith at 08:29 Feb 12, 2016.
JackStrauss
Posts: 236
Posted 11:09 Feb 12, 2016 |

Can you test it out if a zip code does not have exact matches? What would happen?

darkserith
Posts: 45
Posted 11:46 Feb 12, 2016 |
interweblulz wrote:

Can you test it out if a zip code does not have exact matches? What would happen?

Check it out here: http://cs3.calstatela.edu:8080/cs320stu26/Homework3/CoffeeShopLocator

If a zip code does not have exact matches it won't print out the zip code.

For example, test out the zip codes in my original post. If i put in 97302 then it will bring up two locations that has the zip code 97302. If i put in 97302-4682 then only one location will be output, with zip code 97302-4682, as expected.

If the Prof wants me to output any zip code 97302 regardless of whether or not the 4 digit extension is included, I can do that. I just need to know, based on his definition of "exact" for the zip code.

By the way, I've assumed that all the starbucks locations in the excel file are valid locations, even the ones with the names "Vons". Cause i googled some of the locations and they are starbucks in a vons supermarket. So if you type in "anaheim", it will list all starbucks in  city that has the name "anaheim" in it, and you'll also see a listing called "Vons" (3rd column in table)

Also, there's no form validation so make to put in correct values (Prof mentioned in clas we didnt have to implement validation)

Last edited by darkserith at 11:58 Feb 12, 2016.
fmontes3
Posts: 11
Posted 13:39 Feb 12, 2016 |

Can someone push me in the right direction for how to read a CSV file cause I can't figure it out at all.

fmontes3
Posts: 11
Posted 15:53 Feb 12, 2016 |

when testing what was the location you put for csv?

darkserith
Posts: 45
Posted 16:04 Feb 12, 2016 |
fmontes3 wrote:

when testing what was the location you put for csv?

Put the csv file inside WEB-INF. Then get the path to that file using this code:

    ServletContext context = this.getServletContext();

    String csvFile = context.getRealPath("/WEB-INF/starbucks.csv");

 

then you can put csfFile into a FileReader or something to read the input.

 

fmontes3
Posts: 11
Posted 18:16 Feb 12, 2016 |

thanks that solved my problem