Locations of restaurants throughout New Orleans, as indicated by occupational licenses(data.gov). This dataset lists Restaurants that have been registered in New Orleans, Louisiana.
Details
The columns in the data are in order:
- the_geom
- OBJECTID
- BusinessName
- Address
- Suite
- City
- Zip
- PhoneNumber
- BusinessType
- OwnerName
- LocationX
- LocationY
The two you parts you will need for the methods you are tested on are:
-
BusinessName
this will be the restaurant name -
Address
This states the restaurant address -
Suite
this will be the Suite the restaurant is in (if not in a Suite then it will be empty) -
Zip
This states the restaurant zipcode (At least 5 digits) -
PhoneNumber
This states the restaurant phone number (may or may not be empty)
Required Methods To Implement (graded)
We will grade the following methods. Please note, that while there may be different ways to implement them, and you are free to even write helper methods (which we did ourselves) - we need the method names to match the following specification.
CSVReader
This file specifically is used to read the Comma Separated Value files using a Scanner Object. We also used it to help store the indices of the columns in constant variables for easy use in GenderStats.java.
public void initialize(String file)
This method will initialize a class level scanner object based on a File (new File(…)). The name of the file will be passed in. You can assume it is a correct name, but you should also try and catch the IOException that is required by calling new file. The following code can help you get started. You may also want to look at the Digital Humanities lab for an example.
Here is some example code that will help you.
try {
fileScanner = new Scanner(new File(file));
}catch (IOException io) {
io.printStackTrace();
}
public boolean hasNext()
Returns if the scanner has more lines to read if the scanner has been initialized. If the scanner hasn’t been initialized, it will return false. Looking at how scanner checks to see if more lines need to be read will help with this method.
public String[] getNext()
If the scanner has more lines to read, it reads the line and returns a String array of all the values in the line - broken up by the comma (‘,’) delimiter! This is essentially how CSV files are stored.
Stats.java
This file is the main driver file of your program. It will display the restaurants that match the input (zip or Buisness name).
The final output will print out a list of restaurants for the given input (Zip or BuisnessName), and the percent of restaurants listed. Use the following examples as a template for the output
Example given zipcode (70139-0003):
SQUARE ONE RESTAURANT 701 POYDRAS ST 122
Phone#: Not Found
SUBWAY SANDWICHES 701 POYDRAS ST
Phone#: 504-581-6099
Showing 0.165% of total restuarants
Example given Business Name (sushi):
KYOTO SUSHI NOLA LLC 4821 PRYTANIA ST
Phone#: Not Found
GOOD TIME SUSHI 5315 ELYSIAN FIELDS AVE
Phone#: 504-265-0721
SUSHI BROTHER'S 1612 ST CHARLES AVE
Phone#: Not Found
ALOHA GRILL AND SUSHI 3151 CALHOUN ST
Phone#: Not Found
OISHII SUSHI HOUSE 5163 GENERAL DE GAULLE DR STE: N
Phone#: Not Found
IKURA HIBACHI & SUSHI 310 N CARROLLTON AVE STE #100
Phone#: Not Found
YUMMY SUSHI & HIBACHI 6100 HAMBURG ST
Phone#: 504-232-1384
ASUKA SUSHI & HIBACHI 7912 EARHART BLVD
Phone#: Not Found
WASABI SUSHI & BAR 900 FRENCHMEN ST
Phone#: 504-887-9943
GEISHA SUSHI RESTAURANT 111 TCHOUPITOULAS ST
Phone#: 917-517-7136
ASUKA SUSHI & HIBACHI 7912 EARHART BLVD
Phone#: Not Found
JAZZ SUSHI BAR 600 DECATUR ST 206A
Phone#: 504-231-3005
ROYAL SUSHI & BAR 1913 ROYAL ST
Phone#: Not Found
Showing 1.075% of total restuarants
Example given invalid zipcode:
Zipcode: 12345 not found
Showing 0.000% of total restuarants
Example given invalid Buisness Name:
Restaurant: CSU not found
Showing 0.000% of total restuarants
Suggestions / Insights
Before you start coding it is always good to plan your code out. Look at what each method is asking for and think about how you can accomplish it. (Think about how a percent is calculated, and how to compare strings.)
If you would like to expand upon the data there are many different things you could look for. Examples are:
- The amount of businesses with or without registered phone number’s
- Number of restaurants in a suite
- You can sort them by zipcode or alphabetic order
These are just examples feel free to come up with your own ideas of sorting/processing the data.
Reference
- WhitneyS: City of New Orleans, Restaurants, November 16, 2019. New Orleans, LA. https://data.nola.gov/api/views/yc3w-jdut. Access Date: November 2019