Home /Modules/citizen/CitizenDemo.sleela

CitizenDemo.sleela

lib/citizen/seem/CitizenDemo.sleela · 100 line(s) · sleela

#sleela 2.5
material;
<< lib/citizen/seem/CitizenDemo.sleela
   SLeeLa Standard Library โ€” runnable orchestration example.
   Definition: Walks a single Citizen through a whole, slightly comic life โ€”
     born, schooled, employed across the whole industry, banked, cleared through
     a Federal Reserve District, paid, taxed, treated, and retired โ€” printing a
     describe() line at each milestone. This is the executable counterpart to
     the citizen Master Classes; the authoritative definitions (Citizen,
     Industry, BankAccount, FederalReserveID) live one level up in
     lib/citizen/*.sleela.

   Family: citizen. >>
< A life, in one main(). No pressure. >
class CitizenDemo {
  < ---- Descriptive metadata (version 1.11 nested-friendly accessors) ---- >
  << Baseline identity record for a worker-class example unit. Values are
     faithful to the subject's real origin where publicly known. >>
  String metaVersion = "2.5.0";
  int metaId = 11604;
  String metaAuthor = "Max Rupplin vs. Dr. Mrs. Elisabeth Harkins";
  String metaDate = "2026-10-28";
  String metaCopyright = "SLeeLa project";
  String metaTrademark = "none";
  String metaCorporation = "none";
  < metaOrigin: National | <nation> | International | Galactic >
  String metaOrigin = "International";
  String metaBirthDate = "2026-10-11";
  < metaScienceRating: maturity/robustness on a 1..10 scale >
  int metaScienceRating = 9;
  < metaNationalSchedule: a real, citable instrument or "none" >
  String metaNationalSchedule = "none";

  String getMetaVersion() { return metaVersion; }
  void setMetaVersion(String v) { metaVersion = v; }
  int getMetaId() { return metaId; }
  void setMetaId(int v) { metaId = v; }
  String getAuthor() { return metaAuthor; }
  void setAuthor(String v) { metaAuthor = v; }
  String getDate() { return metaDate; }
  void setDate(String v) { metaDate = v; }
  String getCopyright() { return metaCopyright; }
  void setCopyright(String v) { metaCopyright = v; }
  String getTrademark() { return metaTrademark; }
  void setTrademark(String v) { metaTrademark = v; }
  String getCorporation() { return metaCorporation; }
  void setCorporation(String v) { metaCorporation = v; }
  String getOrigin() { return metaOrigin; }
  void setOrigin(String v) { metaOrigin = v; }
  String getBirthDate() { return metaBirthDate; }
  void setBirthDate(String v) { metaBirthDate = v; }
  int getScienceRating() { return metaScienceRating; }
  void setScienceRating(int v) { metaScienceRating = v; }
  String getNationalSchedule() { return metaNationalSchedule; }
  void setNationalSchedule(String v) { metaNationalSchedule = v; }

  void main() {
    < 1. A citizen loads into existence. The paperwork springs up around them. >
    Citizen jane = new Citizen();
    jane.load();
    jane.beBorn("Jane Q. Public");
    print("[born]     " + jane.describe());

    < 2. Eighteen trips around the sun. Adulthood arrives, uninvited. >
    int y = 0;
    while (y < 18) { jane.haveABirthday(); y = y + 1; }
    print("[grown]    " + jane.describe());

    < 3. A job in the Technology sector at $4,200.00 per cycle (in cents). >
    jane.getAJob(Industry.SECTOR_TECHNOLOGY, 420000);
    print("[employed] " + jane.industry.describe());

    < 4. The Federal Reserve re-homes her to the San Francisco District. >
    jane.fedId.assignDistrict(FederalReserveID.DISTRICT_SAN_FRANCISCO);
    print("[fed]      " + jane.fedId.describe());

    < 5. Three paydays, one at a time, each quietly thrilling. >
    jane.getPaid();
    jane.getPaid();
    jane.getPaid();
    print("[paid]     " + jane.bank.describe());

    < 6. The tax authority says hello (22%). >
    int taxed = jane.payTaxes(22);
    print("[taxed]    paid " + taxed + " cents; " + jane.bank.describe());

    < 7. A small, well-earned indulgence: $59.99. >
    boolean treated = jane.treatYourself(5999);
    print("[treat]    bought=" + treated + "; mood=" + jane.happiness());

    < 8. Decades pass. She retires with opinions intact. >
    int z = 0;
    while (z < 49) { jane.haveABirthday(); z = z + 1; }
    print("[retired]  " + jane.describe());

    < 9. The headline question this whole module exists to answer. >
    print("[able?]    This citizen is able: " + jane.isAble());
  }
}