Package Model

Class WrittenBills

java.lang.Object
Model.WrittenBills

public class WrittenBills extends Object
The WrittenBills class represents a collection of utility bills stored in a file.
  • Field Details

    • bills

      private ArrayList<UtilityBill> bills
      The list of utility bills.
    • billsFilePath

      private String billsFilePath
      The path of the file containing the utility bills.
    • id

      private int id
      The ID of the utility bill.
  • Constructor Details

    • WrittenBills

      public WrittenBills()
      Constructs a WrittenBills instance, initializing the list of bills and loading existing bills from a file.
  • Method Details

    • getBills

      public ArrayList<UtilityBill> getBills()
      Gets the list of utility bills.
      Returns:
      ArrayList of UtilityBill representing the bills.
    • loadBillsFromFile

      public void loadBillsFromFile()
      Loads utility bills from a file.
    • findiD

      public boolean findiD(int id)
      Finds a utility bill by its ID.
      Parameters:
      id - The ID of the bill to be found.
    • addBill

      public void addBill(String username, String utilityType, double meterMeasurement, String date)
      Adds a utility bill for the Customer.
      Parameters:
      username - The username of the Customer.
      utilityType - The type of utility.
      meterMeasurement - The meter measurement.
      date - The date of the bill.
    • increaseID

      public void increaseID()
      Increases the ID of the utility bill.
    • deleteBill

      public void deleteBill(int billId)
      Deletes a utility bill for the Customer.
      Parameters:
      billId - The ID of the bill to be deleted.
    • editBill

      public void editBill(int billId, Double newMeterMeasurement)
      Edits a utility bill for the Customer.
      Parameters:
      billId - The ID of the bill to be edited.
      newMeterMeasurement - The new meter measurement.
    • findbill

      public UtilityBill findbill(int billId)
      Finds a utility bill by its ID.
      Parameters:
      billId - The ID of the bill to be found.
    • saveBillsToFile

      private void saveBillsToFile()
      Saves the utility bills to a file.