✅ Enum Representation in Java
Tonga is divided into 5 administrative divisions, which are based on its main island groups:
- Tongatapu
- Vavaʻu
- Haʻapai
- ʻEua
- Niuas (includes Niuafoʻou and Niuatoputapu)
Here’s the Java enum
representing these divisions with short two-letter codes:
java
public enum TongaDivision {
TONGATAPU("TT"),
VAVAU("VV"),
HAAPAI("HP"),
EUA("EU"),
NIUAS("NU");
private final String code;
TongaDivision(String code) {
this.code = code;
}
public String getCode() {
return this.code;
}
}
✅ SQL Representation for Tonga’s Divisions
Below is the SQL schema and INSERT
statements for storing Tonga's 5 divisions:
sql
-- Table for Tonga administrative divisions
CREATE TABLE tonga_divisions (
id INT AUTO_INCREMENT PRIMARY KEY,
name VARCHAR(100) NOT NULL,
code CHAR(2) NOT NULL
);
-- Insert administrative divisions into the table
INSERT INTO tonga_divisions (name, code) VALUES
('Tongatapu', 'TT'),
('Vavaʻu', 'VV'),
('Haʻapai', 'HP'),
('ʻEua', 'EU'),
('Niuas', 'NU');
This structure supports systems involving governance, logistics, public services, and geographic analysis for the Kingdom of Tonga.