Package Model
Class WrittenBills
java.lang.Object
Model.WrittenBills
The WrittenBills class represents a collection of utility bills stored in a
file.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate ArrayList<UtilityBill>The list of utility bills.private StringThe path of the file containing the utility bills.private intThe ID of the utility bill. -
Constructor Summary
ConstructorsConstructorDescriptionConstructs a WrittenBills instance, initializing the list of bills and loading existing bills from a file. -
Method Summary
Modifier and TypeMethodDescriptionvoidAdds a utility bill for the Customer.voiddeleteBill(int billId) Deletes a utility bill for the Customer.voidEdits a utility bill for the Customer.findbill(int billId) Finds a utility bill by its ID.booleanfindiD(int id) Finds a utility bill by its ID.getBills()Gets the list of utility bills.voidIncreases the ID of the utility bill.voidLoads utility bills from a file.private voidSaves the utility bills to a file.
-
Field Details
-
bills
The list of utility bills. -
billsFilePath
The path of the file containing the utility bills. -
id
private int idThe 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
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
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
Edits a utility bill for the Customer.- Parameters:
billId- The ID of the bill to be edited.newMeterMeasurement- The new meter measurement.
-
findbill
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.
-