harryShepherd / Ambry

Software Engineering Methods Group 18
Apache License 2.0
3 stars 0 forks source link

City Standard Epic 3 #47

Closed Alcor2814 closed 4 months ago

Alcor2814 commented 4 months ago

The city standard in Epic 3 needs to retrieve the country of the city but as yet cannot.

Alcor2814 commented 4 months ago

public static ArrayList CityStandard(String select){ ArrayList Cities = new ArrayList();

    try {
        Statement stmt = Database.con.createStatement();
        ResultSet rset = stmt.executeQuery(select);

        while (rset.next()) {
            City city = new City();
            city.setName(rset.getString("city.Name"));
            //Need to store Country
            city.setDistrict(rset.getString("city.District"));
            city.setPopulation(rset.getInt("city.Population"));

            Cities.add(city);
        }
    } catch (SQLException e) {
        throw new RuntimeException(e);
    }

    return Cities;
}
harryShepherd commented 4 months ago

i think the city table only stores the country code, so you can maybe use that and make a function to get a country by country code?

Alcor2814 commented 4 months ago

I'm not sure what the best method for doing and then displaying that would be then Since obviously the country would need to be displayed but without a built-in way to do that that would have to be built into the main

harryShepherd commented 4 months ago

Something like Country getCountryByCode(string code) Or something?

MurdoWa commented 4 months ago

added the function, its in epic 3